Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip automatic form generation when datastore is not enabled #12713

Merged
merged 3 commits into from
Jun 2, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: resolve build errors with latest updates from dev branch
  • Loading branch information
awinberg-aws committed Jun 1, 2023
commit 966da9250410e033209a12f3e276b2624da5a3b3
2 changes: 1 addition & 1 deletion packages/amplify-util-uibuilder/package.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
"access": "public"
},
"dependencies": {
"@aws-amplify/amplify-category-api": "^5.2.1",
"@aws-amplify/amplify-category-api": "^5.4.0",
"@aws-amplify/amplify-cli-core": "4.0.8",
"@aws-amplify/amplify-prompts": "2.7.0",
"@aws-amplify/codegen-ui": "2.14.1",
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ import aws from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependenc
import * as extractArgsDependency from '../commands/utils/extractArgs';
import { run } from '../commands/cloneComponentsFromEnv';
import { isDataStoreEnabled } from '@aws-amplify/amplify-category-api';
import { mocked } from 'ts-jest/utils';

const extractArgsDependencyMock = extractArgsDependency as any;
const awsMock = aws as any;
@@ -17,7 +16,7 @@ jest.mock('@aws-amplify/amplify-category-api', () => ({
jest.mock('../commands/utils/extractArgs');
jest.mock('@aws-amplify/amplify-cli-core');

const isDataStoreEnabledMocked = mocked(isDataStoreEnabled);
const isDataStoreEnabledMocked = jest.mocked(isDataStoreEnabled);

const mockedComponentExport = jest.fn((envName: string) => {
if (envName === 'newEnvName') {
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import aws from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies
import * as utils from '../commands/utils';
import { run } from '../commands/generateComponents';
import { mocked } from 'ts-jest/utils';
import { isDataStoreEnabled } from '@aws-amplify/amplify-category-api';
import { getTransformerVersion } from '../commands/utils/featureFlags';

@@ -18,8 +17,8 @@ jest.mock('../commands/utils/featureFlags', () => ({
const awsMock = aws as any;
const utilsMock = utils as any;

const isDataStoreEnabledMocked = mocked(isDataStoreEnabled);
const getTransformerVersionMocked = mocked(getTransformerVersion);
const isDataStoreEnabledMocked = jest.mocked(isDataStoreEnabled);
const getTransformerVersionMocked = jest.mocked(getTransformerVersion);
utilsMock.shouldRenderComponents = jest.fn().mockReturnValue(true);
utilsMock.notifyMissingPackages = jest.fn().mockReturnValue(true);
utilsMock.getAmplifyDataSchema = jest.fn().mockReturnValue({});
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import { Form } from 'aws-sdk/clients/amplifyuibuilder'; // eslint-disable-line
import { printer } from '@aws-amplify/amplify-prompts'; // eslint-disable-line import/no-extraneous-dependencies
import * as utils from '../commands/utils';
import { prePushHandler } from '../utils/prePushHandler';
import { mocked } from 'ts-jest/utils';
import { isDataStoreEnabled } from '@aws-amplify/amplify-category-api';

jest.mock('../commands/utils');
@@ -19,7 +18,7 @@ jest.mock('@aws-amplify/amplify-category-api', () => ({

const awsMock = aws as any;
const utilsMock = utils as any;
const isDataStoreEnabledMocked = mocked(isDataStoreEnabled);
const isDataStoreEnabledMocked = jest.mocked(isDataStoreEnabled);

utilsMock.shouldRenderComponents = jest.fn().mockImplementation(() => true);

Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ import {
import { AmplifyStudioClient } from '../clients';
import * as createUiBuilderComponentDependency from '../commands/utils/codegenResources';
import { exampleSchema } from './utils';
import { mocked } from 'ts-jest/utils';
import { isDataStoreEnabled } from '@aws-amplify/amplify-category-api';

jest.mock('@aws-amplify/amplify-cli-core', () => ({
@@ -34,7 +33,7 @@ jest.mock('@aws-amplify/amplify-category-api', () => ({
const awsMock = aws as any;
const stateManagerMock = stateManager as any;
const createUiBuilderComponentDependencyMock = createUiBuilderComponentDependency as any;
const isDataStoreEnabledMocked = mocked(isDataStoreEnabled);
const isDataStoreEnabledMocked = jest.mocked(isDataStoreEnabled);

describe('should sync amplify ui builder components', () => {
let context: any;
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -922,6 +922,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@aws-amplify/amplify-util-uibuilder@workspace:packages/amplify-util-uibuilder"
dependencies:
"@aws-amplify/amplify-category-api": ^5.4.0
"@aws-amplify/amplify-cli-core": 4.0.8
"@aws-amplify/amplify-prompts": 2.7.0
"@aws-amplify/appsync-modelgen-plugin": ^2.4.4