@aws-amplify/amplify-util-uibuilder 1.2.20-apiSplitM1.0 → 1.2.20-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/lib/commands/generateComponents.d.ts +1 -1
- package/lib/commands/generateComponents.d.ts.map +1 -1
- package/lib/commands/generateComponents.js +9 -8
- package/lib/commands/generateComponents.js.map +1 -1
- package/lib/commands/utils/createUiBuilderComponent.d.ts +3 -4
- package/lib/commands/utils/createUiBuilderComponent.d.ts.map +1 -1
- package/lib/commands/utils/createUiBuilderComponent.js +12 -20
- package/lib/commands/utils/createUiBuilderComponent.js.map +1 -1
- package/lib/commands/utils/notifyMissingPackages.d.ts +1 -2
- package/lib/commands/utils/notifyMissingPackages.d.ts.map +1 -1
- package/lib/commands/utils/notifyMissingPackages.js +4 -13
- package/lib/commands/utils/notifyMissingPackages.js.map +1 -1
- package/lib/commands/utils/syncAmplifyUiBuilderComponents.d.ts +2 -2
- package/package.json +10 -10
- package/src/__tests__/createUiBuilderComponent.test.ts +2 -2
- package/src/__tests__/generateComponents.test.ts +2 -0
- package/src/__tests__/notifyMissingPackages.test.ts +4 -4
- package/src/commands/generateComponents.ts +16 -11
- package/src/commands/utils/createUiBuilderComponent.ts +44 -21
- package/src/commands/utils/notifyMissingPackages.ts +12 -16
- package/tsconfig.json +7 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/commands/utils/createUiBuilderComponentNew.d.ts +0 -5
- package/lib/commands/utils/createUiBuilderComponentNew.d.ts.map +0 -1
- package/lib/commands/utils/createUiBuilderComponentNew.js +0 -44
- package/lib/commands/utils/createUiBuilderComponentNew.js.map +0 -1
- package/src/commands/utils/createUiBuilderComponentNew.ts +0 -53
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [1.2.20-
|
|
6
|
+
## [1.2.20-beta.1](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.2.19...@aws-amplify/amplify-util-uibuilder@1.2.20-beta.1) (2022-04-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-amplify/amplify-util-uibuilder
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.2.20-beta.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.2.19...@aws-amplify/amplify-util-uibuilder@1.2.20-beta.0) (2022-04-11)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @aws-amplify/amplify-util-uibuilder
|
|
9
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateComponents.d.ts","sourceRoot":"","sources":["../../src/commands/generateComponents.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generateComponents.d.ts","sourceRoot":"","sources":["../../src/commands/generateComponents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAc9C,eAAO,MAAM,GAAG,YAAmB,UAAU,KAAG,QAAQ,IAAI,CA2C3D,CAAC"}
|
|
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.run = void 0;
|
|
7
|
+
const amplify_prompts_1 = require("amplify-prompts");
|
|
8
|
+
const ora_1 = __importDefault(require("ora"));
|
|
7
9
|
const notifyMissingPackages_1 = require("./utils/notifyMissingPackages");
|
|
8
10
|
const shouldRenderComponents_1 = require("./utils/shouldRenderComponents");
|
|
9
11
|
const syncAmplifyUiBuilderComponents_1 = require("./utils/syncAmplifyUiBuilderComponents");
|
|
10
12
|
const createUiBuilderComponent_1 = require("./utils/createUiBuilderComponent");
|
|
11
|
-
const
|
|
12
|
-
const ora_1 = __importDefault(require("ora"));
|
|
13
|
-
async function run(context) {
|
|
13
|
+
const run = async (context) => {
|
|
14
14
|
amplify_prompts_1.printer.debug('Running generate components command in amplify-util-uibuilder');
|
|
15
15
|
if (!(await (0, shouldRenderComponents_1.shouldRenderComponents)(context))) {
|
|
16
16
|
return;
|
|
@@ -39,15 +39,16 @@ async function run(context) {
|
|
|
39
39
|
else {
|
|
40
40
|
spinner.succeed('Synced UI components.');
|
|
41
41
|
}
|
|
42
|
-
(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
const invalidComponentNames = componentSchemas.entities.filter(component => !component.schemaVersion).map(component => component.name);
|
|
43
|
+
if (invalidComponentNames.length) {
|
|
44
|
+
amplify_prompts_1.printer.warn(`The components ${invalidComponentNames.join(', ')} were synced with an older version of Amplify Studio. Please re-sync your components with Figma to get latest features and changes.`);
|
|
45
|
+
}
|
|
46
|
+
(0, notifyMissingPackages_1.notifyMissingPackages)(context);
|
|
46
47
|
}
|
|
47
48
|
catch (e) {
|
|
48
49
|
amplify_prompts_1.printer.debug(e);
|
|
49
50
|
spinner.fail('Failed to sync UI components');
|
|
50
51
|
}
|
|
51
|
-
}
|
|
52
|
+
};
|
|
52
53
|
exports.run = run;
|
|
53
54
|
//# sourceMappingURL=generateComponents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateComponents.js","sourceRoot":"","sources":["../../src/commands/generateComponents.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"generateComponents.js","sourceRoot":"","sources":["../../src/commands/generateComponents.ts"],"names":[],"mappings":";;;;;;AACA,qDAA0C;AAC1C,8CAAsB;AAEtB,yEAAsE;AACtE,2EAAwE;AACxE,2FAKgD;AAChD,+EAAqF;AAK9E,MAAM,GAAG,GAAG,KAAK,EAAE,OAAmB,EAAiB,EAAE;IAC9D,yBAAO,CAAC,KAAK,C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ComponentNew, StudioTheme } from '@aws-amplify/codegen-ui-new';
|
|
1
|
+
import { StudioComponent, StudioTheme, RenderTextComponentResponse } from '@aws-amplify/codegen-ui';
|
|
3
2
|
import { $TSContext } from 'amplify-cli-core';
|
|
4
|
-
export declare const createUiBuilderComponent: (context: $TSContext, schema: StudioComponent) =>
|
|
3
|
+
export declare const createUiBuilderComponent: (context: $TSContext, schema: StudioComponent) => StudioComponent;
|
|
5
4
|
export declare const createUiBuilderTheme: (context: $TSContext, schema: StudioTheme) => StudioTheme;
|
|
6
|
-
export declare const generateAmplifyUiBuilderIndexFile: (context: $TSContext, schemas:
|
|
5
|
+
export declare const generateAmplifyUiBuilderIndexFile: (context: $TSContext, schemas: StudioComponent[]) => RenderTextComponentResponse;
|
|
7
6
|
//# sourceMappingURL=createUiBuilderComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createUiBuilderComponent.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"createUiBuilderComponent.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,WAAW,EAIX,2BAA2B,EAC5B,MAAM,yBAAyB,CAAC;AAWjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAa9C,eAAO,MAAM,wBAAwB,YAAa,UAAU,UAAU,eAAe,KAAG,eAmBvF,CAAC;AAKF,eAAO,MAAM,oBAAoB,YAAa,UAAU,UAAU,WAAW,KAAG,WA0B/E,CAAC;AAKF,eAAO,MAAM,iCAAiC,YAAa,UAAU,WAAW,eAAe,EAAE,KAAG,2BAwBnG,CAAC"}
|
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateAmplifyUiBuilderIndexFile = exports.createUiBuilderTheme = exports.createUiBuilderComponent = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const getUiBuilderComponentsPath_1 = require("./getUiBuilderComponentsPath");
|
|
4
|
+
const codegen_ui_1 = require("@aws-amplify/codegen-ui");
|
|
5
|
+
const codegen_ui_react_1 = require("@aws-amplify/codegen-ui-react");
|
|
7
6
|
const amplify_prompts_1 = require("amplify-prompts");
|
|
8
|
-
const
|
|
9
|
-
const codegen_ui_react_new_1 = require("@aws-amplify/codegen-ui-react-new");
|
|
7
|
+
const getUiBuilderComponentsPath_1 = require("./getUiBuilderComponentsPath");
|
|
10
8
|
const config = {
|
|
11
|
-
module:
|
|
12
|
-
target:
|
|
13
|
-
script:
|
|
9
|
+
module: codegen_ui_react_1.ModuleKind.ES2020,
|
|
10
|
+
target: codegen_ui_react_1.ScriptTarget.ES2020,
|
|
11
|
+
script: codegen_ui_react_1.ScriptKind.JSX,
|
|
14
12
|
renderTypeDeclarations: true,
|
|
15
13
|
};
|
|
16
|
-
const isUpdatedSchema = (schema) => {
|
|
17
|
-
return schema.schemaVersion && schema.schemaVersion === '1.0';
|
|
18
|
-
};
|
|
19
14
|
const createUiBuilderComponent = (context, schema) => {
|
|
20
|
-
if (isUpdatedSchema(schema)) {
|
|
21
|
-
return (0, createUiBuilderComponentNew_1.createUiBuilderComponent)(context, schema);
|
|
22
|
-
}
|
|
23
15
|
const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
|
|
24
|
-
const rendererFactory = new
|
|
16
|
+
const rendererFactory = new codegen_ui_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_1.AmplifyRenderer(component, config));
|
|
25
17
|
const outputPathDir = uiBuilderComponentsPath;
|
|
26
|
-
const rendererManager = new
|
|
18
|
+
const rendererManager = new codegen_ui_1.StudioTemplateRendererManager(rendererFactory, {
|
|
27
19
|
outputPathDir,
|
|
28
20
|
});
|
|
29
21
|
rendererManager.renderSchemaToTemplate(schema);
|
|
@@ -32,9 +24,9 @@ const createUiBuilderComponent = (context, schema) => {
|
|
|
32
24
|
exports.createUiBuilderComponent = createUiBuilderComponent;
|
|
33
25
|
const createUiBuilderTheme = (context, schema) => {
|
|
34
26
|
const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
|
|
35
|
-
const rendererFactory = new
|
|
27
|
+
const rendererFactory = new codegen_ui_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_1.ReactThemeStudioTemplateRenderer(component, config));
|
|
36
28
|
const outputPathDir = uiBuilderComponentsPath;
|
|
37
|
-
const rendererManager = new
|
|
29
|
+
const rendererManager = new codegen_ui_1.StudioTemplateRendererManager(rendererFactory, {
|
|
38
30
|
outputPathDir,
|
|
39
31
|
});
|
|
40
32
|
try {
|
|
@@ -51,9 +43,9 @@ const createUiBuilderTheme = (context, schema) => {
|
|
|
51
43
|
exports.createUiBuilderTheme = createUiBuilderTheme;
|
|
52
44
|
const generateAmplifyUiBuilderIndexFile = (context, schemas) => {
|
|
53
45
|
const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
|
|
54
|
-
const rendererFactory = new
|
|
46
|
+
const rendererFactory = new codegen_ui_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_1.ReactIndexStudioTemplateRenderer(component, config));
|
|
55
47
|
const outputPathDir = uiBuilderComponentsPath;
|
|
56
|
-
const rendererManager = new
|
|
48
|
+
const rendererManager = new codegen_ui_1.StudioTemplateRendererManager(rendererFactory, {
|
|
57
49
|
outputPathDir,
|
|
58
50
|
});
|
|
59
51
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createUiBuilderComponent.js","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponent.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"createUiBuilderComponent.js","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponent.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AO,MAAM,CAAC;KACf;IAAC,OAAO,CAAC,EAAE;QACV,yBAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,yBAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACpD,yBAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,CAAC,CAAC;KACT;AACH,CAAC,CAAC;AA1BW,QAAA,oBAAoB,wBA0B/B;AAKK,MAAM,iCAAiC,GAAG,CAAC,OAAmB,EAAE,OAA0B,EAA+B,EAAE;IAChI,MAAM,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,IAAI,0CAA6B,CACvD,CAAC,SAA4B,EAAE,EAAE,CAAC,IAAI,mDAAgC,CAAC,SAAS,EAAE,MAAM,CAKrF,CACJ,CAAC;IAEF,MAAM,aAAa,GAAG,uBAAuB,CAAC;IAE9C,MAAM,eAAe,GAAG,IAAI,0CAA6B,CAAC,eAAe,EAAE;QACzE,aAAa;KACd,CAAC,CAAC;IAEH,IAAI;QACF,OAAO,eAAe,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;KACxD;IAAC,OAAO,CAAC,EAAE;QACV,yBAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,yBAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,MAAM,CAAC,CAAC;KACT;AACH,CAAC,CAAC;AAxBW,QAAA,iCAAiC,qCAwB5C"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { $TSContext } from 'amplify-cli-core';
|
|
2
|
-
|
|
3
|
-
export declare const notifyMissingPackages: (context: $TSContext, schemas: StudioComponent[]) => void;
|
|
2
|
+
export declare const notifyMissingPackages: (context: $TSContext) => void;
|
|
4
3
|
//# sourceMappingURL=notifyMissingPackages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyMissingPackages.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/notifyMissingPackages.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"notifyMissingPackages.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/notifyMissingPackages.ts"],"names":[],"mappings":"AAAA,OAAO,EACuB,UAAU,EACvC,MAAM,kBAAkB,CAAC;AAe1B,eAAO,MAAM,qBAAqB,YAAa,UAAU,KAAG,IA8B3D,CAAC"}
|
|
@@ -9,19 +9,10 @@ const amplify_prompts_1 = require("amplify-prompts");
|
|
|
9
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const subset_1 = __importDefault(require("semver/ranges/subset"));
|
|
12
|
+
const codegen_ui_react_1 = require("@aws-amplify/codegen-ui-react");
|
|
12
13
|
const extractArgs_1 = require("./extractArgs");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const isUpdatedSchema = (schemas) => {
|
|
16
|
-
return schemas.some(schema => schema.schemaVersion && schema.schemaVersion === '1.0');
|
|
17
|
-
};
|
|
18
|
-
const getRequiredDependencies = (schemas) => {
|
|
19
|
-
if (isUpdatedSchema(schemas)) {
|
|
20
|
-
return new codegen_ui_react_new_1.ReactRequiredDependencyProvider().getRequiredDependencies();
|
|
21
|
-
}
|
|
22
|
-
return new codegen_ui_react_old_1.ReactRequiredDependencyProvider().getRequiredDependencies();
|
|
23
|
-
};
|
|
24
|
-
const notifyMissingPackages = (context, schemas) => {
|
|
14
|
+
const getRequiredDependencies = () => new codegen_ui_react_1.ReactRequiredDependencyProvider().getRequiredDependencies();
|
|
15
|
+
const notifyMissingPackages = (context) => {
|
|
25
16
|
var _a;
|
|
26
17
|
const args = (0, extractArgs_1.extractArgs)(context);
|
|
27
18
|
const localEnvFilePath = (_a = args.localEnvFilePath) !== null && _a !== void 0 ? _a : amplify_cli_core_1.pathManager.getLocalEnvFilePath();
|
|
@@ -36,7 +27,7 @@ const notifyMissingPackages = (context, schemas) => {
|
|
|
36
27
|
return;
|
|
37
28
|
}
|
|
38
29
|
const packageJson = amplify_cli_core_1.JSONUtilities.readJson(packageJsonPath);
|
|
39
|
-
getRequiredDependencies(
|
|
30
|
+
getRequiredDependencies().forEach((dependency) => {
|
|
40
31
|
const packageIsInstalled = Object.keys(packageJson.dependencies).includes(dependency.dependencyName);
|
|
41
32
|
if (!packageIsInstalled) {
|
|
42
33
|
amplify_prompts_1.printer.warn(`UIBuilder components required "${dependency.dependencyName}" that is not in your package.json. Run \`npm install "${dependency.dependencyName}@${dependency.supportedSemVerPattern}"\`. ${dependency.reason}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyMissingPackages.js","sourceRoot":"","sources":["../../../src/commands/utils/notifyMissingPackages.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"notifyMissingPackages.js","sourceRoot":"","sources":["../../../src/commands/utils/notifyMissingPackages.ts"],"names":[],"mappings":";;;;;;AAAA,uDAE0B;AAC1B,qDAA0C;AAC1C,wDAA0B;AAC1B,gDAAwB;AACxB,kEAA+C;AAE/C,oEAAgF;AAChF,+CAA4C;AAE5C,MAAM,uBAAuB,GAAG,GAAyB,EAAE,CAAC,IAAI,kDAA+B,EAAE,CAAC,uBAAuB,EAAE,CAAC;AAMrH,MAAM,qBAAqB,GAAG,CAAC,OAAmB,EAAQ,EAAE;;IACjE,MAAM,IAAI,GAAG,IAAA,yBAAW,EAAC,OAAO,CAAC,CAAC;IAClC,MAAM,gBAAgB,GAAG,MAAA,IAAI,CAAC,gBAAgB,mCAAI,8BAAW,CAAC,mBAAmB,EAAE,CAAC;IACpF,IAAI,CAAC,kBAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QACpC,yBAAO,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAC;QAC9F,OAAO;KACR;IACD,MA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
|
7
7
|
export declare function listUiBuilderThemes(context: $TSContext, envName?: string): Promise<import("aws-sdk/lib/request").PromiseResult<aws.AmplifyUIBuilder.ExportThemesResponse, aws.AWSError>>;
|
|
8
8
|
export declare function generateUiBuilderComponents(context: $TSContext, componentSchemas: any[]): ({
|
|
9
9
|
resultType: string;
|
|
10
|
-
component: import("@aws-amplify/codegen-ui
|
|
10
|
+
component: import("@aws-amplify/codegen-ui").StudioComponent;
|
|
11
11
|
schemaName?: undefined;
|
|
12
12
|
error?: undefined;
|
|
13
13
|
} | {
|
|
@@ -18,7 +18,7 @@ export declare function generateUiBuilderComponents(context: $TSContext, compone
|
|
|
18
18
|
})[];
|
|
19
19
|
export declare function generateUiBuilderThemes(context: $TSContext, themeSchemas: any[]): ({
|
|
20
20
|
resultType: string;
|
|
21
|
-
theme: import("@aws-amplify/codegen-ui
|
|
21
|
+
theme: import("@aws-amplify/codegen-ui").StudioTheme;
|
|
22
22
|
schemaName?: undefined;
|
|
23
23
|
error?: undefined;
|
|
24
24
|
} | {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/amplify-util-uibuilder",
|
|
3
|
-
"version": "1.2.20-
|
|
3
|
+
"version": "1.2.20-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@aws-amplify/codegen-ui
|
|
17
|
-
"@aws-amplify/codegen-ui-
|
|
18
|
-
"
|
|
19
|
-
"@aws-amplify/codegen-ui-react-old": "npm:@aws-amplify/codegen-ui-react@1.2.0",
|
|
20
|
-
"amplify-cli-core": "2.5.2-apiSplitM1.0",
|
|
16
|
+
"@aws-amplify/codegen-ui": "2.1.2",
|
|
17
|
+
"@aws-amplify/codegen-ui-react": "2.1.2",
|
|
18
|
+
"amplify-cli-core": "2.5.2-beta.1",
|
|
21
19
|
"amplify-prompts": "2.0.0",
|
|
22
|
-
"amplify-provider-awscloudformation": "6.0.1
|
|
23
|
-
"aws-sdk": "2.1084.0"
|
|
20
|
+
"amplify-provider-awscloudformation": "6.1.0-beta.1",
|
|
21
|
+
"aws-sdk": "2.1084.0",
|
|
22
|
+
"ora": "^4.0.3"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
|
-
"@
|
|
25
|
+
"@types/fs-extra": "^8.0.1",
|
|
26
|
+
"@types/semver": "^7.1.0"
|
|
27
27
|
},
|
|
28
28
|
"jest": {
|
|
29
29
|
"testRunner": "jest-circus/runner",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"usePathForSuiteName": "true",
|
|
61
61
|
"addFileAttribute": "true"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "633bd0f12b72c97c60f3f365e546e18459a53b74"
|
|
64
64
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as codegen from '@aws-amplify/codegen-ui
|
|
1
|
+
import * as codegen from '@aws-amplify/codegen-ui';
|
|
2
2
|
import {
|
|
3
3
|
generateAmplifyUiBuilderIndexFile,
|
|
4
4
|
createUiBuilderTheme,
|
|
5
5
|
createUiBuilderComponent,
|
|
6
6
|
} from '../commands/utils/createUiBuilderComponent';
|
|
7
|
-
jest.mock('@aws-amplify/codegen-ui
|
|
7
|
+
jest.mock('@aws-amplify/codegen-ui');
|
|
8
8
|
const codegen_mock = codegen as any;
|
|
9
9
|
const renderSchemaToTemplateMock = jest.fn();
|
|
10
10
|
|
|
@@ -23,7 +23,7 @@ describe('should notify when packages are missing', () => {
|
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
|
-
notifyMissingPackages(context as JSONUtilitiesDependency.$TSContext
|
|
26
|
+
notifyMissingPackages(context as JSONUtilitiesDependency.$TSContext);
|
|
27
27
|
expect(printerDependency.printer.debug).toBeCalledTimes(1);
|
|
28
28
|
});
|
|
29
29
|
|
|
@@ -39,7 +39,7 @@ describe('should notify when packages are missing', () => {
|
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
|
-
notifyMissingPackages(context as JSONUtilitiesDependency.$TSContext
|
|
42
|
+
notifyMissingPackages(context as JSONUtilitiesDependency.$TSContext);
|
|
43
43
|
expect(printerDependency.printer.debug).toBeCalledTimes(1);
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -51,7 +51,7 @@ describe('should notify when packages are missing', () => {
|
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
|
-
notifyMissingPackages(context as JSONUtilitiesDependency.$TSContext
|
|
54
|
+
notifyMissingPackages(context as JSONUtilitiesDependency.$TSContext);
|
|
55
55
|
expect(printerDependency.printer.warn).toBeCalledTimes(1);
|
|
56
56
|
});
|
|
57
57
|
|
|
@@ -67,7 +67,7 @@ describe('should notify when packages are missing', () => {
|
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
};
|
|
70
|
-
notifyMissingPackages(context as JSONUtilitiesDependency.$TSContext
|
|
70
|
+
notifyMissingPackages(context as JSONUtilitiesDependency.$TSContext);
|
|
71
71
|
expect(printerDependency.printer.warn).toBeCalledTimes(1);
|
|
72
72
|
});
|
|
73
73
|
});
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { StudioComponent } from '@aws-amplify/codegen-ui';
|
|
2
|
+
import { printer } from 'amplify-prompts';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import { $TSContext } from 'amplify-cli-core';
|
|
1
5
|
import { notifyMissingPackages } from './utils/notifyMissingPackages';
|
|
2
6
|
import { shouldRenderComponents } from './utils/shouldRenderComponents';
|
|
3
7
|
import {
|
|
@@ -6,13 +10,12 @@ import {
|
|
|
6
10
|
generateUiBuilderComponents,
|
|
7
11
|
generateUiBuilderThemes,
|
|
8
12
|
} from './utils/syncAmplifyUiBuilderComponents';
|
|
9
|
-
import { StudioComponent as StudioComponentNew } from '@aws-amplify/codegen-ui-new';
|
|
10
13
|
import { generateAmplifyUiBuilderIndexFile } from './utils/createUiBuilderComponent';
|
|
11
|
-
import { printer } from 'amplify-prompts';
|
|
12
|
-
import ora from 'ora';
|
|
13
|
-
import { $TSContext } from 'amplify-cli-core';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Pulls ui components from Studio backend and generates the code in the user's file system
|
|
17
|
+
*/
|
|
18
|
+
export const run = async (context: $TSContext): Promise<void> => {
|
|
16
19
|
printer.debug('Running generate components command in amplify-util-uibuilder');
|
|
17
20
|
if (!(await shouldRenderComponents(context))) {
|
|
18
21
|
return;
|
|
@@ -32,7 +35,7 @@ export async function run(context: $TSContext) {
|
|
|
32
35
|
generateAmplifyUiBuilderIndexFile(context, [
|
|
33
36
|
...generatedComponentResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ component }) => component),
|
|
34
37
|
...generatedThemeResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ theme }) => theme),
|
|
35
|
-
] as
|
|
38
|
+
] as StudioComponent[]);
|
|
36
39
|
|
|
37
40
|
const failedSchemas = [
|
|
38
41
|
...generatedComponentResults.filter(({ resultType }) => resultType === 'FAILURE').map(({ schemaName }) => schemaName),
|
|
@@ -45,12 +48,14 @@ export async function run(context: $TSContext) {
|
|
|
45
48
|
spinner.succeed('Synced UI components.');
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
const invalidComponentNames = componentSchemas.entities.filter(component => !component.schemaVersion).map(component => component.name);
|
|
52
|
+
if (invalidComponentNames.length) {
|
|
53
|
+
printer.warn(`The components ${invalidComponentNames.join(', ')} were synced with an older version of Amplify Studio. Please re-sync your components with Figma to get latest features and changes.`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
notifyMissingPackages(context);
|
|
52
57
|
} catch (e) {
|
|
53
58
|
printer.debug(e);
|
|
54
59
|
spinner.fail('Failed to sync UI components');
|
|
55
60
|
}
|
|
56
|
-
}
|
|
61
|
+
};
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
StudioTemplateRendererManager,
|
|
3
|
+
StudioComponent,
|
|
4
|
+
StudioTheme,
|
|
5
|
+
StudioTemplateRendererFactory,
|
|
6
|
+
StudioTemplateRenderer,
|
|
7
|
+
FrameworkOutputManager,
|
|
8
|
+
RenderTextComponentResponse,
|
|
9
|
+
} from '@aws-amplify/codegen-ui';
|
|
2
10
|
import {
|
|
3
11
|
AmplifyRenderer,
|
|
4
12
|
ReactThemeStudioTemplateRenderer,
|
|
13
|
+
ReactIndexStudioTemplateRenderer,
|
|
5
14
|
ModuleKind,
|
|
6
15
|
ScriptTarget,
|
|
7
16
|
ScriptKind,
|
|
8
|
-
} from '@aws-amplify/codegen-ui-react
|
|
17
|
+
} from '@aws-amplify/codegen-ui-react';
|
|
9
18
|
|
|
10
|
-
import {StudioComponent as StudioComponentNew, StudioTheme} from '@aws-amplify/codegen-ui-new';
|
|
11
|
-
import { getUiBuilderComponentsPath } from './getUiBuilderComponentsPath';
|
|
12
19
|
import { printer } from 'amplify-prompts';
|
|
13
20
|
import { $TSContext } from 'amplify-cli-core';
|
|
14
|
-
import {
|
|
15
|
-
|
|
21
|
+
import { getUiBuilderComponentsPath } from './getUiBuilderComponentsPath';
|
|
22
|
+
|
|
16
23
|
const config = {
|
|
17
24
|
module: ModuleKind.ES2020,
|
|
18
25
|
target: ScriptTarget.ES2020,
|
|
@@ -20,18 +27,13 @@ const config = {
|
|
|
20
27
|
renderTypeDeclarations: true,
|
|
21
28
|
};
|
|
22
29
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export const createUiBuilderComponent = (context: $TSContext, schema: StudioComponent) => {
|
|
28
|
-
if (isUpdatedSchema(schema)) {
|
|
29
|
-
return createUiBuilderComponentNew(context, schema as unknown as StudioComponentNew);
|
|
30
|
-
}
|
|
30
|
+
/**
|
|
31
|
+
* Writes component file to the work space
|
|
32
|
+
*/
|
|
33
|
+
export const createUiBuilderComponent = (context: $TSContext, schema: StudioComponent): StudioComponent => {
|
|
31
34
|
const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
|
|
32
35
|
const rendererFactory = new StudioTemplateRendererFactory(
|
|
33
|
-
(component: StudioComponent) =>
|
|
34
|
-
new AmplifyRenderer(component as StudioComponent, config) as unknown as StudioTemplateRenderer<
|
|
36
|
+
(component: StudioComponent) => new AmplifyRenderer(component as StudioComponent, config) as unknown as StudioTemplateRenderer<
|
|
35
37
|
unknown,
|
|
36
38
|
StudioComponent,
|
|
37
39
|
FrameworkOutputManager<unknown>,
|
|
@@ -49,9 +51,19 @@ export const createUiBuilderComponent = (context: $TSContext, schema: StudioComp
|
|
|
49
51
|
return schema;
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Writes theme file to the work space
|
|
56
|
+
*/
|
|
57
|
+
export const createUiBuilderTheme = (context: $TSContext, schema: StudioTheme): StudioTheme => {
|
|
53
58
|
const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
|
|
54
|
-
const rendererFactory = new StudioTemplateRendererFactory(
|
|
59
|
+
const rendererFactory = new StudioTemplateRendererFactory(
|
|
60
|
+
(component: StudioTheme) => new ReactThemeStudioTemplateRenderer(component, config) as unknown as StudioTemplateRenderer<
|
|
61
|
+
unknown,
|
|
62
|
+
StudioTheme,
|
|
63
|
+
FrameworkOutputManager<unknown>,
|
|
64
|
+
RenderTextComponentResponse
|
|
65
|
+
>,
|
|
66
|
+
);
|
|
55
67
|
|
|
56
68
|
const outputPathDir = uiBuilderComponentsPath;
|
|
57
69
|
|
|
@@ -70,9 +82,19 @@ export const createUiBuilderTheme = (context: $TSContext, schema: StudioTheme) =
|
|
|
70
82
|
}
|
|
71
83
|
};
|
|
72
84
|
|
|
73
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Writes index file to the work space
|
|
87
|
+
*/
|
|
88
|
+
export const generateAmplifyUiBuilderIndexFile = (context: $TSContext, schemas: StudioComponent[]): RenderTextComponentResponse => {
|
|
74
89
|
const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
|
|
75
|
-
const rendererFactory = new StudioTemplateRendererFactory(
|
|
90
|
+
const rendererFactory = new StudioTemplateRendererFactory(
|
|
91
|
+
(component: StudioComponent[]) => new ReactIndexStudioTemplateRenderer(component, config) as unknown as StudioTemplateRenderer<
|
|
92
|
+
unknown,
|
|
93
|
+
StudioComponent[],
|
|
94
|
+
FrameworkOutputManager<unknown>,
|
|
95
|
+
RenderTextComponentResponse
|
|
96
|
+
>,
|
|
97
|
+
);
|
|
76
98
|
|
|
77
99
|
const outputPathDir = uiBuilderComponentsPath;
|
|
78
100
|
|
|
@@ -86,4 +108,5 @@ export const generateAmplifyUiBuilderIndexFile = (context: $TSContext, schemas:
|
|
|
86
108
|
printer.debug(e);
|
|
87
109
|
printer.debug('Failed to generate component index file');
|
|
88
110
|
throw e;
|
|
89
|
-
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
pathManager, JSONUtilities, $TSContext, $TSAny,
|
|
3
|
+
} from 'amplify-cli-core';
|
|
2
4
|
import { printer } from 'amplify-prompts';
|
|
3
5
|
import fs from 'fs-extra';
|
|
4
6
|
import path from 'path';
|
|
5
7
|
import rangeSubset from 'semver/ranges/subset';
|
|
8
|
+
import { RequiredDependency } from '@aws-amplify/codegen-ui';
|
|
9
|
+
import { ReactRequiredDependencyProvider } from '@aws-amplify/codegen-ui-react';
|
|
6
10
|
import { extractArgs } from './extractArgs';
|
|
7
|
-
import { ReactRequiredDependencyProvider } from '@aws-amplify/codegen-ui-react-old';
|
|
8
|
-
import { ReactRequiredDependencyProvider as ReactRequiredDependencyProviderNew } from '@aws-amplify/codegen-ui-react-new';
|
|
9
|
-
import { StudioComponent } from '@aws-amplify/codegen-ui-new';
|
|
10
11
|
|
|
11
|
-
const
|
|
12
|
-
return schemas.some(schema => schema.schemaVersion && schema.schemaVersion === '1.0');
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const getRequiredDependencies = (schemas: StudioComponent[]) => {
|
|
16
|
-
if (isUpdatedSchema(schemas)) {
|
|
17
|
-
return new ReactRequiredDependencyProviderNew().getRequiredDependencies();
|
|
18
|
-
}
|
|
19
|
-
return new ReactRequiredDependencyProvider().getRequiredDependencies();
|
|
20
|
-
};
|
|
12
|
+
const getRequiredDependencies = (): RequiredDependency[] => new ReactRequiredDependencyProvider().getRequiredDependencies();
|
|
21
13
|
|
|
22
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Displays a warning to the user if they have npm dependencies
|
|
16
|
+
* they need to install in their application for UIBuilder components to work properly
|
|
17
|
+
*/
|
|
18
|
+
export const notifyMissingPackages = (context: $TSContext): void => {
|
|
23
19
|
const args = extractArgs(context);
|
|
24
20
|
const localEnvFilePath = args.localEnvFilePath ?? pathManager.getLocalEnvFilePath();
|
|
25
21
|
if (!fs.existsSync(localEnvFilePath)) {
|
|
@@ -33,7 +29,7 @@ export const notifyMissingPackages = (context: $TSContext, schemas: StudioCompon
|
|
|
33
29
|
return;
|
|
34
30
|
}
|
|
35
31
|
const packageJson = JSONUtilities.readJson(packageJsonPath) as { dependencies: { [key: string]: string } };
|
|
36
|
-
getRequiredDependencies(
|
|
32
|
+
getRequiredDependencies().forEach((dependency: $TSAny) => {
|
|
37
33
|
const packageIsInstalled = Object.keys(packageJson.dependencies).includes(dependency.dependencyName);
|
|
38
34
|
if (!packageIsInstalled) {
|
|
39
35
|
printer.warn(
|
package/tsconfig.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./lib",
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"skipLibCheck": true
|
|
9
8
|
}
|
|
9
|
+
}
|