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

chore(amplify-util-uibuilder): remove codegen-ui usage #13234

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/amplify-util-uibuilder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
"@aws-amplify/amplify-category-api": "^5.6.4",
"@aws-amplify/amplify-cli-core": "4.2.7",
"@aws-amplify/amplify-prompts": "2.8.4",
"@aws-amplify/codegen-ui": "2.14.2",
"@aws-amplify/codegen-ui-react": "2.14.2",
"amplify-codegen": "^4.6.2",
"aws-sdk": "^2.1426.0",
"fs-extra": "^8.1.0",
Expand All @@ -28,10 +26,12 @@
},
"devDependencies": {
"@aws-amplify/appsync-modelgen-plugin": "^2.6.0",
"@aws-amplify/datastore": "^4.7.5",
"@types/fs-extra": "^8.0.1",
"@types/jest": "^29.5.1",
"@types/semver": "^7.1.0",
"@types/tiny-async-pool": "^2.0.0",
"semver": "^7.5.4",
"ts-jest": "^29.1.0"
},
"jest": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import semver from 'semver';
import { ReactRequiredDependencyProvider } from '../commands/utils/codegen-ui-dependency-provider';

describe('ReactStudioDependencyProvider', () => {
const requiredDependencies = new ReactRequiredDependencyProvider().getRequiredDependencies(false);
const requiredDependenciesWithStorageManager = new ReactRequiredDependencyProvider().getRequiredDependencies(true);

describe('getRequiredDependencies', () => {
it('has required dependencies', () => {
expect(requiredDependencies.length).toBeGreaterThan(0);
});

it('includes ui-react', () => {
expect(requiredDependencies.filter((dep) => dep.dependencyName === '@aws-amplify/ui-react')).toBeTruthy();
});

it('includes all valid semver values', () => {
requiredDependencies.forEach((dep) => {
expect(semver.valid(dep.supportedSemVerPattern)).toBeDefined();
});
});

it('includes reasons on all dependencies', () => {
requiredDependencies.forEach((dep) => {
expect(dep.reason.length).toBeGreaterThan(0);
});
});

it('does not include ui-react-storage if user does not use StorageManager', () => {
expect(requiredDependencies.filter((dep) => dep.dependencyName !== '@aws-amplify/ui-react-storage')).toBeTruthy();
});

it('includes ui-react-storage if user is using StorageManager', () => {
expect(requiredDependenciesWithStorageManager.filter((dep) => dep.dependencyName === '@aws-amplify/ui-react-storage')).toBeTruthy();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const getUiBuilderComponentsPathMocked = getUiBuilderComponentsPath as any;
utilsMock.shouldRenderComponents = jest.fn().mockReturnValue(true);
utilsMock.notifyMissingPackages = jest.fn().mockReturnValue(true);
utilsMock.getAmplifyDataSchema = jest.fn().mockReturnValue({});
utilsMock.mapGenericDataSchemaToCodegen = jest.fn().mockReturnValue({});
utilsMock.isFormDetachedFromModel = jest.fn().mockReturnValue(false);
utilsMock.extractUIComponents = jest.fn().mockReturnValue(undefined);
utilsMock.waitForSucceededJob = jest
Expand Down