@aws-amplify/amplify-util-uibuilder 1.2.12 → 1.2.13-studio-q1-release.0
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 +8 -0
- package/lib/commands/generateComponents.d.ts.map +1 -1
- package/lib/commands/generateComponents.js +4 -1
- package/lib/commands/generateComponents.js.map +1 -1
- package/lib/commands/utils/createUiBuilderComponent.d.ts +1 -1
- package/lib/commands/utils/createUiBuilderComponent.d.ts.map +1 -1
- package/lib/commands/utils/createUiBuilderComponent.js +20 -24
- package/lib/commands/utils/createUiBuilderComponent.js.map +1 -1
- package/lib/commands/utils/createUiBuilderComponentNew.d.ts +5 -0
- package/lib/commands/utils/createUiBuilderComponentNew.d.ts.map +1 -0
- package/lib/commands/utils/createUiBuilderComponentNew.js +64 -0
- package/lib/commands/utils/createUiBuilderComponentNew.js.map +1 -0
- package/lib/commands/utils/notifyMissingPackages.d.ts +1 -1
- package/lib/commands/utils/notifyMissingPackages.d.ts.map +1 -1
- package/lib/commands/utils/notifyMissingPackages.js +18 -13
- package/lib/commands/utils/notifyMissingPackages.js.map +1 -1
- package/package.json +8 -6
- package/src/__tests__/createUiBuilderComponent.test.ts +2 -2
- package/src/__tests__/notifyMissingPackages.test.ts +5 -5
- package/src/commands/generateComponents.ts +5 -2
- package/src/commands/utils/createUiBuilderComponent.ts +16 -22
- package/src/commands/utils/createUiBuilderComponentNew.ts +75 -0
- package/src/commands/utils/notifyMissingPackages.ts +26 -15
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.13-studio-q1-release.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.2.12...@aws-amplify/amplify-util-uibuilder@1.2.13-studio-q1-release.0) (2022-03-02)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-amplify/amplify-util-uibuilder
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [1.2.12](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.2.11...@aws-amplify/amplify-util-uibuilder@1.2.12) (2022-02-15)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @aws-amplify/amplify-util-uibuilder
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateComponents.d.ts","sourceRoot":"","sources":["../../src/commands/generateComponents.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,wBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"generateComponents.d.ts","sourceRoot":"","sources":["../../src/commands/generateComponents.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,wBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,iBAyC5C"}
|
|
@@ -39,12 +39,15 @@ async function run(context) {
|
|
|
39
39
|
else {
|
|
40
40
|
spinner.succeed('Synced UI components.');
|
|
41
41
|
}
|
|
42
|
+
(0, notifyMissingPackages_1.notifyMissingPackages)(context, [
|
|
43
|
+
...generatedComponentResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ component }) => component),
|
|
44
|
+
...generatedThemeResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ theme }) => theme),
|
|
45
|
+
]);
|
|
42
46
|
}
|
|
43
47
|
catch (e) {
|
|
44
48
|
amplify_prompts_1.printer.debug(e);
|
|
45
49
|
spinner.fail('Failed to sync UI components');
|
|
46
50
|
}
|
|
47
|
-
(0, notifyMissingPackages_1.notifyMissingPackages)(context);
|
|
48
51
|
}
|
|
49
52
|
exports.run = run;
|
|
50
53
|
//# sourceMappingURL=generateComponents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateComponents.js","sourceRoot":"","sources":["../../src/commands/generateComponents.ts"],"names":[],"mappings":";;;;;;AAAA,yEAAsE;AACtE,2EAAwE;AACxE,2FAKgD;AAChD,+EAAqF;AACrF,qDAA0C;AAC1C,8CAAsB;AAGf,KAAK,UAAU,GAAG,CAAC,OAAmB;IAC3C,yBAAO,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;IAC/E,IAAI,CAAC,CAAC,MAAM,IAAA,+CAAsB,EAAC,OAAO,CAAC,CAAC,EAAE;QAC5C,OAAO;KACR;IACD,MAAM,OAAO,GAAG,IAAA,aAAG,EAAC,EAAE,CAAC,CAAC;IACxB,IAAI;QACF,MAAM,CAAC,gBAAgB,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAA,wDAAuB,EAAC,OAAO,CAAC,EAAE,IAAA,oDAAmB,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC7H,IAAI,gBAAgB,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAChF,yBAAO,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;YACxE,OAAO;SACR;QAED,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAC7C,MAAM,yBAAyB,GAAG,IAAA,4DAA2B,EAAC,OAAO,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAClG,MAAM,qBAAqB,GAAG,IAAA,wDAAuB,EAAC,OAAO,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEtF,IAAA,4DAAiC,EAAC,OAAO,EAAE;YACzC,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,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AE,EAAE,EAAE,CAAC,UAAU,CAAC;YACrH,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC;SAClH,CAAC;QAEF,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,OAAO,CAAC,IAAI,CAAC,4CAA4C,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACtF;aAAM;YACL,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;SAC1C;QAED,IAAA,6CAAqB,EAAC,OAAO,EAAE;YAC7B,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC;YACnH,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC;SACxG,CAAC,CAAC;KACJ;IAAC,OAAO,CAAC,EAAE;QACV,yBAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;KAC9C;AACH,CAAC;AAzCD,kBAyCC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $TSContext } from 'amplify-cli-core';
|
|
2
2
|
export declare const createUiBuilderComponent: (context: $TSContext, schema: any) => any;
|
|
3
3
|
export declare const createUiBuilderTheme: (context: $TSContext, schema: any) => any;
|
|
4
|
-
export declare const generateAmplifyUiBuilderIndexFile: (context: $TSContext, schemas: any[]) => import("@aws-amplify/codegen-ui").RenderTextComponentResponse;
|
|
4
|
+
export declare const generateAmplifyUiBuilderIndexFile: (context: $TSContext, schemas: any[]) => import("@aws-amplify/codegen-ui-new").RenderTextComponentResponse;
|
|
5
5
|
//# sourceMappingURL=createUiBuilderComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createUiBuilderComponent.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createUiBuilderComponent.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponent.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAa9C,eAAO,MAAM,wBAAwB,YAAa,UAAU,UAAU,GAAG,QAgBxE,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAa,UAAU,UAAU,GAAG,QAuBpE,CAAC;AAEF,eAAO,MAAM,iCAAiC,YAAa,UAAU,WAAW,GAAG,EAAE,sEAEpF,CAAC"}
|
|
@@ -1,36 +1,46 @@
|
|
|
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
|
|
4
|
+
const codegen_ui_old_1 = require("@aws-amplify/codegen-ui-old");
|
|
5
|
+
const codegen_ui_react_old_1 = require("@aws-amplify/codegen-ui-react-old");
|
|
6
6
|
const getUiBuilderComponentsPath_1 = require("./getUiBuilderComponentsPath");
|
|
7
7
|
const amplify_prompts_1 = require("amplify-prompts");
|
|
8
|
+
const createUiBuilderComponentNew_1 = require("./createUiBuilderComponentNew");
|
|
8
9
|
const config = {
|
|
9
|
-
module:
|
|
10
|
-
target:
|
|
11
|
-
script:
|
|
10
|
+
module: codegen_ui_react_old_1.ModuleKind.ES2020,
|
|
11
|
+
target: codegen_ui_react_old_1.ScriptTarget.ES2020,
|
|
12
|
+
script: codegen_ui_react_old_1.ScriptKind.JSX,
|
|
12
13
|
renderTypeDeclarations: true,
|
|
13
14
|
};
|
|
15
|
+
const isUpdatedSchema = (schema) => {
|
|
16
|
+
return schema.schemaVersion && schema.schemaVersion == '1.0';
|
|
17
|
+
};
|
|
14
18
|
const createUiBuilderComponent = (context, schema) => {
|
|
19
|
+
if (isUpdatedSchema(schema)) {
|
|
20
|
+
return (0, createUiBuilderComponentNew_1.createUiBuilderComponent)(context, schema);
|
|
21
|
+
}
|
|
15
22
|
const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
|
|
16
|
-
const rendererFactory = new
|
|
23
|
+
const rendererFactory = new codegen_ui_old_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_old_1.AmplifyRenderer(component, config));
|
|
17
24
|
const outputPathDir = uiBuilderComponentsPath;
|
|
18
25
|
const outputConfig = {
|
|
19
26
|
outputPathDir,
|
|
20
27
|
};
|
|
21
|
-
const rendererManager = new
|
|
28
|
+
const rendererManager = new codegen_ui_old_1.StudioTemplateRendererManager(rendererFactory, outputConfig);
|
|
22
29
|
rendererManager.renderSchemaToTemplate(schema);
|
|
23
30
|
return schema;
|
|
24
31
|
};
|
|
25
32
|
exports.createUiBuilderComponent = createUiBuilderComponent;
|
|
26
33
|
const createUiBuilderTheme = (context, schema) => {
|
|
34
|
+
if (isUpdatedSchema(schema)) {
|
|
35
|
+
return (0, createUiBuilderComponentNew_1.createUiBuilderTheme)(context, schema);
|
|
36
|
+
}
|
|
27
37
|
const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
|
|
28
|
-
const rendererFactory = new
|
|
38
|
+
const rendererFactory = new codegen_ui_old_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_old_1.ReactThemeStudioTemplateRenderer(component, config));
|
|
29
39
|
const outputPathDir = uiBuilderComponentsPath;
|
|
30
40
|
const outputConfig = {
|
|
31
41
|
outputPathDir,
|
|
32
42
|
};
|
|
33
|
-
const rendererManager = new
|
|
43
|
+
const rendererManager = new codegen_ui_old_1.StudioTemplateRendererManager(rendererFactory, outputConfig);
|
|
34
44
|
try {
|
|
35
45
|
rendererManager.renderSchemaToTemplate(schema);
|
|
36
46
|
return schema;
|
|
@@ -44,21 +54,7 @@ const createUiBuilderTheme = (context, schema) => {
|
|
|
44
54
|
};
|
|
45
55
|
exports.createUiBuilderTheme = createUiBuilderTheme;
|
|
46
56
|
const generateAmplifyUiBuilderIndexFile = (context, schemas) => {
|
|
47
|
-
|
|
48
|
-
const rendererFactory = new codegen_ui_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_1.ReactIndexStudioTemplateRenderer(component, config));
|
|
49
|
-
const outputPathDir = uiBuilderComponentsPath;
|
|
50
|
-
const outputConfig = {
|
|
51
|
-
outputPathDir,
|
|
52
|
-
};
|
|
53
|
-
const rendererManager = new codegen_ui_1.StudioTemplateRendererManager(rendererFactory, outputConfig);
|
|
54
|
-
try {
|
|
55
|
-
return rendererManager.renderSchemaToTemplate(schemas);
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
amplify_prompts_1.printer.debug(e);
|
|
59
|
-
amplify_prompts_1.printer.debug('Failed to generate component index file');
|
|
60
|
-
throw e;
|
|
61
|
-
}
|
|
57
|
+
return (0, createUiBuilderComponentNew_1.generateAmplifyUiBuilderIndexFile)(context, schemas);
|
|
62
58
|
};
|
|
63
59
|
exports.generateAmplifyUiBuilderIndexFile = generateAmplifyUiBuilderIndexFile;
|
|
64
60
|
//# sourceMappingURL=createUiBuilderComponent.js.map
|
|
@@ -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":"","s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kDAAuB,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACjD;IACD,MAAM,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,IAAI,8CAA6B,CAAC,CAAC,SAAc,EAAE,EAAE,CAAC,IAAI,uDAAgC,CAAC,SAAS,EAAE,MAAM,CAAQ,CAAC,CAAC;IAE9I,MAAM,aAAa,GAAG,uBAAuB,CAAC;IAC9C,MAAM,YAAY,GAAG;QACnB,aAAa;KACd,CAAC;IAEF,MAAM,eAAe,GAAG,IAAI,8CAA6B,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;IAEzF,IAAI;QACF,eAAe,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAC/C,OAAO,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;AAvBW,QAAA,oBAAoB,wBAuB/B;AAEK,MAAM,iCAAiC,GAAG,CAAC,OAAmB,EAAE,OAAc,EAAE,EAAE;IACrF,OAAO,IAAA,+DAAoC,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC,CAAC;AAFW,QAAA,iCAAiC,qCAE5C"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { $TSContext } from 'amplify-cli-core';
|
|
2
|
+
export declare const createUiBuilderComponent: (context: $TSContext, schema: any) => any;
|
|
3
|
+
export declare const createUiBuilderTheme: (context: $TSContext, schema: any) => any;
|
|
4
|
+
export declare const generateAmplifyUiBuilderIndexFile: (context: $TSContext, schemas: any[]) => import("@aws-amplify/codegen-ui-new").RenderTextComponentResponse;
|
|
5
|
+
//# sourceMappingURL=createUiBuilderComponentNew.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createUiBuilderComponentNew.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponentNew.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQ9C,eAAO,MAAM,wBAAwB,YAAa,UAAU,UAAU,GAAG,QAaxE,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAa,UAAU,UAAU,GAAG,QAoBpE,CAAC;AAEF,eAAO,MAAM,iCAAiC,YAAa,UAAU,WAAW,GAAG,EAAE,sEAkBpF,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateAmplifyUiBuilderIndexFile = exports.createUiBuilderTheme = exports.createUiBuilderComponent = void 0;
|
|
4
|
+
const codegen_ui_new_1 = require("@aws-amplify/codegen-ui-new");
|
|
5
|
+
const codegen_ui_react_new_1 = require("@aws-amplify/codegen-ui-react-new");
|
|
6
|
+
const getUiBuilderComponentsPath_1 = require("./getUiBuilderComponentsPath");
|
|
7
|
+
const amplify_prompts_1 = require("amplify-prompts");
|
|
8
|
+
const config = {
|
|
9
|
+
module: codegen_ui_react_new_1.ModuleKind.ES2020,
|
|
10
|
+
target: codegen_ui_react_new_1.ScriptTarget.ES2020,
|
|
11
|
+
script: codegen_ui_react_new_1.ScriptKind.JSX,
|
|
12
|
+
renderTypeDeclarations: true,
|
|
13
|
+
};
|
|
14
|
+
const createUiBuilderComponent = (context, schema) => {
|
|
15
|
+
const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
|
|
16
|
+
const rendererFactory = new codegen_ui_new_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_new_1.AmplifyRenderer(component, config));
|
|
17
|
+
const outputPathDir = uiBuilderComponentsPath;
|
|
18
|
+
const outputConfig = {
|
|
19
|
+
outputPathDir,
|
|
20
|
+
};
|
|
21
|
+
const rendererManager = new codegen_ui_new_1.StudioTemplateRendererManager(rendererFactory, outputConfig);
|
|
22
|
+
rendererManager.renderSchemaToTemplate(schema);
|
|
23
|
+
return schema;
|
|
24
|
+
};
|
|
25
|
+
exports.createUiBuilderComponent = createUiBuilderComponent;
|
|
26
|
+
const createUiBuilderTheme = (context, schema) => {
|
|
27
|
+
const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
|
|
28
|
+
const rendererFactory = new codegen_ui_new_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_new_1.ReactThemeStudioTemplateRenderer(component, config));
|
|
29
|
+
const outputPathDir = uiBuilderComponentsPath;
|
|
30
|
+
const outputConfig = {
|
|
31
|
+
outputPathDir,
|
|
32
|
+
};
|
|
33
|
+
const rendererManager = new codegen_ui_new_1.StudioTemplateRendererManager(rendererFactory, outputConfig);
|
|
34
|
+
try {
|
|
35
|
+
rendererManager.renderSchemaToTemplate(schema);
|
|
36
|
+
return schema;
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
amplify_prompts_1.printer.debug(e);
|
|
40
|
+
amplify_prompts_1.printer.debug('Skipping invalid theme with schema');
|
|
41
|
+
amplify_prompts_1.printer.debug(JSON.stringify(schema, null, 2));
|
|
42
|
+
throw e;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.createUiBuilderTheme = createUiBuilderTheme;
|
|
46
|
+
const generateAmplifyUiBuilderIndexFile = (context, schemas) => {
|
|
47
|
+
const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
|
|
48
|
+
const rendererFactory = new codegen_ui_new_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_new_1.ReactIndexStudioTemplateRenderer(component, config));
|
|
49
|
+
const outputPathDir = uiBuilderComponentsPath;
|
|
50
|
+
const outputConfig = {
|
|
51
|
+
outputPathDir,
|
|
52
|
+
};
|
|
53
|
+
const rendererManager = new codegen_ui_new_1.StudioTemplateRendererManager(rendererFactory, outputConfig);
|
|
54
|
+
try {
|
|
55
|
+
return rendererManager.renderSchemaToTemplate(schemas);
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
amplify_prompts_1.printer.debug(e);
|
|
59
|
+
amplify_prompts_1.printer.debug('Failed to generate component index file');
|
|
60
|
+
throw e;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.generateAmplifyUiBuilderIndexFile = generateAmplifyUiBuilderIndexFile;
|
|
64
|
+
//# sourceMappingURL=createUiBuilderComponentNew.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createUiBuilderComponentNew.js","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponentNew.ts"],"names":[],"mappings":";;;AAAA,gEAA4H;AAC5H,4EAO2C;AAC3C,6EAA0E;AAC1E,qDAA0C;AAE1C,MAAM,MAAM,GAAG;IACb,MAAM,EAAE,iCAAU,CAAC,MAAM;IACzB,MAAM,EAAE,mCAAY,CAAC,MAAM;IAC3B,MAAM,EAAE,iCAAU,CAAC,GAAG;IACtB,sBAAsB,EAAE,IAAI;CAC7B,CAAC;AAEK,MAAM,wBAAwB,GAAG,CAAC,OAAmB,EAAE,MAAW,EAAE,EAAE;IAC3E,MAAM,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,IAAI,8CAA6B,CAAC,CAAC,SAAc,EAAE,EAAE,CAAC,IAAI,sCAAe,CAAC,SAAS,EAAE,MAAM,CAAQ,CAAC,CAAC;IAE7H,MAAM,aAAa,GAAG,uBAAuB,CAAC;IAC9C,MAAM,YAAY,GAAG;QACnB,aAAa;KACd,CAAC;IAEF,MAAM,eAAe,GAAG,IAAI,8CAA6B,CAAC,eAAe,E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I,MAAM,aAAa,GAAG,uBAAuB,CAAC;IAC9C,MAAM,YAAY,GAAG;QACnB,aAAa;KACd,CAAC;IAEF,MAAM,eAAe,GAAG,IAAI,8CAA6B,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;IAEzF,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;AAlBW,QAAA,iCAAiC,qCAkB5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyMissingPackages.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/notifyMissingPackages.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,UAAU,EAAU,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"notifyMissingPackages.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/notifyMissingPackages.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,UAAU,EAAU,MAAM,kBAAkB,CAAC;AAoBlF,eAAO,MAAM,qBAAqB,YAAa,UAAU,WAAW,GAAG,EAAE,SA8BxE,CAAC"}
|
|
@@ -8,9 +8,20 @@ const amplify_cli_core_1 = require("amplify-cli-core");
|
|
|
8
8
|
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
|
+
const subset_1 = __importDefault(require("semver/ranges/subset"));
|
|
11
12
|
const extractArgs_1 = require("./extractArgs");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
13
|
+
const codegen_ui_react_old_1 = require("@aws-amplify/codegen-ui-react-old");
|
|
14
|
+
const codegen_ui_react_new_1 = require("@aws-amplify/codegen-ui-react-new");
|
|
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
25
|
var _a;
|
|
15
26
|
const args = (0, extractArgs_1.extractArgs)(context);
|
|
16
27
|
const localEnvFilePath = (_a = args.localEnvFilePath) !== null && _a !== void 0 ? _a : amplify_cli_core_1.pathManager.getLocalEnvFilePath();
|
|
@@ -25,21 +36,15 @@ const notifyMissingPackages = (context) => {
|
|
|
25
36
|
return;
|
|
26
37
|
}
|
|
27
38
|
const packageJson = amplify_cli_core_1.JSONUtilities.readJson(packageJsonPath);
|
|
28
|
-
|
|
29
|
-
const packageIsInstalled = Object.keys(packageJson.dependencies).includes(
|
|
39
|
+
getRequiredDependencies(schemas).forEach((dependency) => {
|
|
40
|
+
const packageIsInstalled = Object.keys(packageJson.dependencies).includes(dependency.dependencyName);
|
|
30
41
|
if (!packageIsInstalled) {
|
|
31
|
-
amplify_prompts_1.printer.warn(`UIBuilder components required "${
|
|
42
|
+
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}`);
|
|
32
43
|
}
|
|
33
|
-
else if (!
|
|
34
|
-
amplify_prompts_1.printer.warn(`UIBuilder components requires version "${
|
|
44
|
+
else if (!(0, subset_1.default)(packageJson.dependencies[dependency.dependencyName], dependency.supportedSemVerPattern)) {
|
|
45
|
+
amplify_prompts_1.printer.warn(`UIBuilder components requires version "${dependency.supportedSemVerPattern}" of "${dependency.dependencyName}". You currently are on version "${packageJson.dependencies[dependency.dependencyName]}". Run \`npm install "${dependency.dependencyName}@${dependency.supportedSemVerPattern}"\`. ${dependency.reason}`);
|
|
35
46
|
}
|
|
36
47
|
});
|
|
37
48
|
};
|
|
38
49
|
exports.notifyMissingPackages = notifyMissingPackages;
|
|
39
|
-
const packageVersionMatches = (requiredVersion, existingVersion) => {
|
|
40
|
-
if (requiredVersion === '*') {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
return requiredVersion === existingVersion;
|
|
44
|
-
};
|
|
45
50
|
//# sourceMappingURL=notifyMissingPackages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyMissingPackages.js","sourceRoot":"","sources":["../../../src/commands/utils/notifyMissingPackages.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAkF;AAClF,qDAA0C;AAC1C,wDAA0B;AAC1B,gDAAwB;AACxB,+CAA4C;AAC5C,MAAM,
|
|
1
|
+
{"version":3,"file":"notifyMissingPackages.js","sourceRoot":"","sources":["../../../src/commands/utils/notifyMissingPackages.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAkF;AAClF,qDAA0C;AAC1C,wDAA0B;AAC1B,gDAAwB;AACxB,kEAA+C;AAC/C,+CAA4C;AAC5C,4EAAoF;AACpF,4EAA0H;AAE1H,MAAM,eAAe,GAAG,CAAC,OAAc,EAAE,EAAE;IACzC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,IAAI,KAAK,CAAC,CAAC;AACvF,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,OAAc,EAAE,EAAE;IACjD,IAAI,eAAe,CAAC,OAAO,CAAC,EAAE;QAC5B,OAAO,IAAI,sDAAkC,EAAE,CAAC,uBAAuB,EAAE,CAAC;KAC3E;IACD,OAAO,IAAI,sDAA+B,EAAE,C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AAC,EAAE,UAAU,CAAC,sBAAsB,CAAC,EAAE;YAC/G,yBAAO,CAAC,IAAI,CACV,0CAA0C,UAAU,CAAC,sBAAsB,SACzE,UAAU,CAAC,cACb,oCAAoC,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,cAAc,CAAC,yBACrF,UAAU,CAAC,cACb,IAAI,UAAU,CAAC,sBAAsB,QAAQ,UAAU,CAAC,MAAM,EAAE,CACjE,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA9BW,QAAA,qBAAqB,yBA8BhC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/amplify-util-uibuilder",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.13-studio-q1-release.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@aws-amplify/codegen-ui": "1.
|
|
17
|
-
"@aws-amplify/codegen-ui-
|
|
16
|
+
"@aws-amplify/codegen-ui-new": "npm:@aws-amplify/codegen-ui@2.1.0",
|
|
17
|
+
"@aws-amplify/codegen-ui-old": "npm:@aws-amplify/codegen-ui@1.2.0",
|
|
18
|
+
"@aws-amplify/codegen-ui-react-new": "npm:@aws-amplify/codegen-ui-react@2.1.0",
|
|
19
|
+
"@aws-amplify/codegen-ui-react-old": "npm:@aws-amplify/codegen-ui-react@1.2.0",
|
|
18
20
|
"amplify-cli-core": "2.4.15",
|
|
19
21
|
"amplify-prompts": "1.6.3",
|
|
20
|
-
"amplify-provider-awscloudformation": "5.9.
|
|
21
|
-
"aws-sdk": "
|
|
22
|
+
"amplify-provider-awscloudformation": "5.9.7-studio-q1-release.0",
|
|
23
|
+
"aws-sdk": "2.1084.0"
|
|
22
24
|
},
|
|
23
25
|
"jest": {
|
|
24
26
|
"testRunner": "jest-circus/runner",
|
|
@@ -55,5 +57,5 @@
|
|
|
55
57
|
"usePathForSuiteName": "true",
|
|
56
58
|
"addFileAttribute": "true"
|
|
57
59
|
},
|
|
58
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "7e943d2c7331c7222bb35818689df7182f18395a"
|
|
59
61
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as codegen from '@aws-amplify/codegen-ui';
|
|
1
|
+
import * as codegen from '@aws-amplify/codegen-ui-old';
|
|
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-old');
|
|
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 any);
|
|
26
|
+
notifyMissingPackages(context as any, []);
|
|
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 any);
|
|
42
|
+
notifyMissingPackages(context as any, []);
|
|
43
43
|
expect(printerDependency.printer.debug).toBeCalledTimes(1);
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -51,8 +51,8 @@ describe('should notify when packages are missing', () => {
|
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
|
-
notifyMissingPackages(context as any);
|
|
55
|
-
expect(printerDependency.printer.warn).toBeCalledTimes(
|
|
54
|
+
notifyMissingPackages(context as any, []);
|
|
55
|
+
expect(printerDependency.printer.warn).toBeCalledTimes(1);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
it('notifies for partial missing dependencies', async () => {
|
|
@@ -67,7 +67,7 @@ describe('should notify when packages are missing', () => {
|
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
};
|
|
70
|
-
notifyMissingPackages(context as any);
|
|
70
|
+
notifyMissingPackages(context as any, []);
|
|
71
71
|
expect(printerDependency.printer.warn).toBeCalledTimes(1);
|
|
72
72
|
});
|
|
73
73
|
});
|
|
@@ -43,10 +43,13 @@ export async function run(context: $TSContext) {
|
|
|
43
43
|
} else {
|
|
44
44
|
spinner.succeed('Synced UI components.');
|
|
45
45
|
}
|
|
46
|
+
|
|
47
|
+
notifyMissingPackages(context, [
|
|
48
|
+
...generatedComponentResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ component }) => component),
|
|
49
|
+
...generatedThemeResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ theme }) => theme),
|
|
50
|
+
]);
|
|
46
51
|
} catch (e) {
|
|
47
52
|
printer.debug(e);
|
|
48
53
|
spinner.fail('Failed to sync UI components');
|
|
49
54
|
}
|
|
50
|
-
|
|
51
|
-
notifyMissingPackages(context);
|
|
52
55
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { StudioTemplateRendererManager, StudioTemplateRendererFactory, StudioComponent } from '@aws-amplify/codegen-ui';
|
|
1
|
+
import { StudioTemplateRendererManager, StudioTemplateRendererFactory, StudioComponent } from '@aws-amplify/codegen-ui-old';
|
|
2
2
|
import {
|
|
3
3
|
AmplifyRenderer,
|
|
4
4
|
ReactThemeStudioTemplateRenderer,
|
|
5
|
-
ReactIndexStudioTemplateRenderer,
|
|
6
5
|
ModuleKind,
|
|
7
6
|
ScriptTarget,
|
|
8
7
|
ScriptKind,
|
|
9
|
-
} from '@aws-amplify/codegen-ui-react';
|
|
8
|
+
} from '@aws-amplify/codegen-ui-react-old';
|
|
10
9
|
import { getUiBuilderComponentsPath } from './getUiBuilderComponentsPath';
|
|
11
10
|
import { printer } from 'amplify-prompts';
|
|
12
11
|
import { $TSContext } from 'amplify-cli-core';
|
|
12
|
+
import { createUiBuilderComponent as createUiBuilderComponentNew, createUiBuilderTheme as createUiBuilderThemeNew, generateAmplifyUiBuilderIndexFile as generateAmplifyUiBuilderIndexFileNew} from './createUiBuilderComponentNew';
|
|
13
13
|
const config = {
|
|
14
14
|
module: ModuleKind.ES2020,
|
|
15
15
|
target: ScriptTarget.ES2020,
|
|
@@ -17,9 +17,16 @@ const config = {
|
|
|
17
17
|
renderTypeDeclarations: true,
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
const isUpdatedSchema = (schema: any) => {
|
|
21
|
+
return schema.schemaVersion && schema.schemaVersion == '1.0'
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
export const createUiBuilderComponent = (context: $TSContext, schema: any) => {
|
|
25
|
+
if (isUpdatedSchema(schema)) {
|
|
26
|
+
return createUiBuilderComponentNew(context, schema);
|
|
27
|
+
}
|
|
21
28
|
const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
|
|
22
|
-
const rendererFactory = new StudioTemplateRendererFactory((component: StudioComponent) => new AmplifyRenderer(component, config));
|
|
29
|
+
const rendererFactory = new StudioTemplateRendererFactory((component: StudioComponent) => new AmplifyRenderer(component as any, config) as any);
|
|
23
30
|
|
|
24
31
|
const outputPathDir = uiBuilderComponentsPath;
|
|
25
32
|
const outputConfig = {
|
|
@@ -33,8 +40,11 @@ export const createUiBuilderComponent = (context: $TSContext, schema: any) => {
|
|
|
33
40
|
};
|
|
34
41
|
|
|
35
42
|
export const createUiBuilderTheme = (context: $TSContext, schema: any) => {
|
|
43
|
+
if (isUpdatedSchema(schema)) {
|
|
44
|
+
return createUiBuilderThemeNew(context, schema);
|
|
45
|
+
}
|
|
36
46
|
const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
|
|
37
|
-
const rendererFactory = new StudioTemplateRendererFactory((component: any) => new ReactThemeStudioTemplateRenderer(component, config));
|
|
47
|
+
const rendererFactory = new StudioTemplateRendererFactory((component: any) => new ReactThemeStudioTemplateRenderer(component, config) as any);
|
|
38
48
|
|
|
39
49
|
const outputPathDir = uiBuilderComponentsPath;
|
|
40
50
|
const outputConfig = {
|
|
@@ -55,21 +65,5 @@ export const createUiBuilderTheme = (context: $TSContext, schema: any) => {
|
|
|
55
65
|
};
|
|
56
66
|
|
|
57
67
|
export const generateAmplifyUiBuilderIndexFile = (context: $TSContext, schemas: any[]) => {
|
|
58
|
-
|
|
59
|
-
const rendererFactory = new StudioTemplateRendererFactory((component: any) => new ReactIndexStudioTemplateRenderer(component, config));
|
|
60
|
-
|
|
61
|
-
const outputPathDir = uiBuilderComponentsPath;
|
|
62
|
-
const outputConfig = {
|
|
63
|
-
outputPathDir,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const rendererManager = new StudioTemplateRendererManager(rendererFactory, outputConfig);
|
|
67
|
-
|
|
68
|
-
try {
|
|
69
|
-
return rendererManager.renderSchemaToTemplate(schemas);
|
|
70
|
-
} catch (e) {
|
|
71
|
-
printer.debug(e);
|
|
72
|
-
printer.debug('Failed to generate component index file');
|
|
73
|
-
throw e;
|
|
74
|
-
}
|
|
68
|
+
return generateAmplifyUiBuilderIndexFileNew(context, schemas);
|
|
75
69
|
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { StudioTemplateRendererManager, StudioTemplateRendererFactory, StudioComponent } from '@aws-amplify/codegen-ui-new';
|
|
2
|
+
import {
|
|
3
|
+
AmplifyRenderer,
|
|
4
|
+
ReactThemeStudioTemplateRenderer,
|
|
5
|
+
ReactIndexStudioTemplateRenderer,
|
|
6
|
+
ModuleKind,
|
|
7
|
+
ScriptTarget,
|
|
8
|
+
ScriptKind,
|
|
9
|
+
} from '@aws-amplify/codegen-ui-react-new';
|
|
10
|
+
import { getUiBuilderComponentsPath } from './getUiBuilderComponentsPath';
|
|
11
|
+
import { printer } from 'amplify-prompts';
|
|
12
|
+
import { $TSContext } from 'amplify-cli-core';
|
|
13
|
+
const config = {
|
|
14
|
+
module: ModuleKind.ES2020,
|
|
15
|
+
target: ScriptTarget.ES2020,
|
|
16
|
+
script: ScriptKind.JSX,
|
|
17
|
+
renderTypeDeclarations: true,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const createUiBuilderComponent = (context: $TSContext, schema: any) => {
|
|
21
|
+
const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
|
|
22
|
+
const rendererFactory = new StudioTemplateRendererFactory((component: any) => new AmplifyRenderer(component, config) as any);
|
|
23
|
+
|
|
24
|
+
const outputPathDir = uiBuilderComponentsPath;
|
|
25
|
+
const outputConfig = {
|
|
26
|
+
outputPathDir,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const rendererManager = new StudioTemplateRendererManager(rendererFactory, outputConfig);
|
|
30
|
+
|
|
31
|
+
rendererManager.renderSchemaToTemplate(schema);
|
|
32
|
+
return schema;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const createUiBuilderTheme = (context: $TSContext, schema: any) => {
|
|
36
|
+
const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
|
|
37
|
+
const rendererFactory = new StudioTemplateRendererFactory((component: any) => new ReactThemeStudioTemplateRenderer(component, config) as any);
|
|
38
|
+
|
|
39
|
+
const outputPathDir = uiBuilderComponentsPath;
|
|
40
|
+
const outputConfig = {
|
|
41
|
+
outputPathDir,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const rendererManager = new StudioTemplateRendererManager(rendererFactory, outputConfig);
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
rendererManager.renderSchemaToTemplate(schema);
|
|
48
|
+
return schema;
|
|
49
|
+
} catch (e) {
|
|
50
|
+
printer.debug(e);
|
|
51
|
+
printer.debug('Skipping invalid theme with schema');
|
|
52
|
+
printer.debug(JSON.stringify(schema, null, 2));
|
|
53
|
+
throw e;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const generateAmplifyUiBuilderIndexFile = (context: $TSContext, schemas: any[]) => {
|
|
58
|
+
const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
|
|
59
|
+
const rendererFactory = new StudioTemplateRendererFactory((component: any) => new ReactIndexStudioTemplateRenderer(component, config) as any);
|
|
60
|
+
|
|
61
|
+
const outputPathDir = uiBuilderComponentsPath;
|
|
62
|
+
const outputConfig = {
|
|
63
|
+
outputPathDir,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const rendererManager = new StudioTemplateRendererManager(rendererFactory, outputConfig);
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
return rendererManager.renderSchemaToTemplate(schemas);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
printer.debug(e);
|
|
72
|
+
printer.debug('Failed to generate component index file');
|
|
73
|
+
throw e;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
@@ -2,10 +2,23 @@ import { pathManager, JSONUtilities, $TSContext, $TSAny } from 'amplify-cli-core
|
|
|
2
2
|
import { printer } from 'amplify-prompts';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
4
|
import path from 'path';
|
|
5
|
+
import rangeSubset from 'semver/ranges/subset';
|
|
5
6
|
import { extractArgs } from './extractArgs';
|
|
6
|
-
|
|
7
|
+
import { ReactRequiredDependencyProvider } from '@aws-amplify/codegen-ui-react-old';
|
|
8
|
+
import { ReactRequiredDependencyProvider as ReactRequiredDependencyProviderNew } from '@aws-amplify/codegen-ui-react-new';
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
const isUpdatedSchema = (schemas: any[]) => {
|
|
11
|
+
return schemas.some(schema => schema.schemaVersion && schema.schemaVersion == '1.0');
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const getRequiredDependencies = (schemas: any[]) => {
|
|
15
|
+
if (isUpdatedSchema(schemas)) {
|
|
16
|
+
return new ReactRequiredDependencyProviderNew().getRequiredDependencies();
|
|
17
|
+
}
|
|
18
|
+
return new ReactRequiredDependencyProvider().getRequiredDependencies();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const notifyMissingPackages = (context: $TSContext, schemas: any[]) => {
|
|
9
22
|
const args = extractArgs(context);
|
|
10
23
|
const localEnvFilePath = args.localEnvFilePath ?? pathManager.getLocalEnvFilePath();
|
|
11
24
|
if (!fs.existsSync(localEnvFilePath)) {
|
|
@@ -19,22 +32,20 @@ export const notifyMissingPackages = (context: $TSContext) => {
|
|
|
19
32
|
return;
|
|
20
33
|
}
|
|
21
34
|
const packageJson = JSONUtilities.readJson(packageJsonPath) as { dependencies: { [key: string]: string } };
|
|
22
|
-
|
|
23
|
-
const packageIsInstalled = Object.keys(packageJson.dependencies).includes(
|
|
35
|
+
getRequiredDependencies(schemas).forEach((dependency: any) => {
|
|
36
|
+
const packageIsInstalled = Object.keys(packageJson.dependencies).includes(dependency.dependencyName);
|
|
24
37
|
if (!packageIsInstalled) {
|
|
25
|
-
printer.warn(`UIBuilder components required "${packageName}" that is not in your package.json. Run \`npm install ${packageName}\``);
|
|
26
|
-
} else if (!packageVersionMatches(REQUIRED_PACKAGES[packageName], packageJson.dependencies[packageName])) {
|
|
27
38
|
printer.warn(
|
|
28
|
-
`UIBuilder components
|
|
39
|
+
`UIBuilder components required "${dependency.dependencyName}" that is not in your package.json. Run \`npm install "${dependency.dependencyName}@${dependency.supportedSemVerPattern}"\`. ${dependency.reason}`,
|
|
40
|
+
);
|
|
41
|
+
} else if (!rangeSubset(packageJson.dependencies[dependency.dependencyName], dependency.supportedSemVerPattern)) {
|
|
42
|
+
printer.warn(
|
|
43
|
+
`UIBuilder components requires version "${dependency.supportedSemVerPattern}" of "${
|
|
44
|
+
dependency.dependencyName
|
|
45
|
+
}". You currently are on version "${packageJson.dependencies[dependency.dependencyName]}". Run \`npm install "${
|
|
46
|
+
dependency.dependencyName
|
|
47
|
+
}@${dependency.supportedSemVerPattern}"\`. ${dependency.reason}`,
|
|
29
48
|
);
|
|
30
49
|
}
|
|
31
50
|
});
|
|
32
51
|
};
|
|
33
|
-
|
|
34
|
-
const packageVersionMatches = (requiredVersion: string, existingVersion: string) => {
|
|
35
|
-
if (requiredVersion === '*') {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return requiredVersion === existingVersion;
|
|
40
|
-
};
|