@aws-amplify/amplify-util-uibuilder 1.2.16-pin-codegen-dependency.0 → 1.2.16

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/lib/commands/generateComponents.d.ts +1 -1
  3. package/lib/commands/generateComponents.d.ts.map +1 -1
  4. package/lib/commands/generateComponents.js +8 -9
  5. package/lib/commands/generateComponents.js.map +1 -1
  6. package/lib/commands/utils/createUiBuilderComponent.d.ts +4 -3
  7. package/lib/commands/utils/createUiBuilderComponent.d.ts.map +1 -1
  8. package/lib/commands/utils/createUiBuilderComponent.js +20 -12
  9. package/lib/commands/utils/createUiBuilderComponent.js.map +1 -1
  10. package/lib/commands/utils/createUiBuilderComponentNew.d.ts +5 -0
  11. package/lib/commands/utils/createUiBuilderComponentNew.d.ts.map +1 -0
  12. package/lib/commands/utils/createUiBuilderComponentNew.js +44 -0
  13. package/lib/commands/utils/createUiBuilderComponentNew.js.map +1 -0
  14. package/lib/commands/utils/notifyMissingPackages.d.ts +2 -1
  15. package/lib/commands/utils/notifyMissingPackages.d.ts.map +1 -1
  16. package/lib/commands/utils/notifyMissingPackages.js +13 -4
  17. package/lib/commands/utils/notifyMissingPackages.js.map +1 -1
  18. package/lib/commands/utils/syncAmplifyUiBuilderComponents.d.ts +2 -2
  19. package/package.json +12 -10
  20. package/src/__tests__/createUiBuilderComponent.test.ts +2 -2
  21. package/src/__tests__/generateComponents.test.ts +0 -2
  22. package/src/__tests__/notifyMissingPackages.test.ts +4 -4
  23. package/src/commands/generateComponents.ts +11 -16
  24. package/src/commands/utils/createUiBuilderComponent.ts +21 -44
  25. package/src/commands/utils/createUiBuilderComponentNew.ts +53 -0
  26. package/src/commands/utils/notifyMissingPackages.ts +16 -12
  27. package/tsconfig.json +7 -7
  28. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
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.16-pin-codegen-dependency.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.2.15...@aws-amplify/amplify-util-uibuilder@1.2.16-pin-codegen-dependency.0) (2022-03-09)
6
+ ## [1.2.16](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.2.15...@aws-amplify/amplify-util-uibuilder@1.2.16) (2022-03-14)
7
7
 
8
8
  **Note:** Version bump only for package @aws-amplify/amplify-util-uibuilder
9
9
 
@@ -1,3 +1,3 @@
1
1
  import { $TSContext } from 'amplify-cli-core';
2
- export declare const run: (context: $TSContext) => Promise<void>;
2
+ export declare function run(context: $TSContext): Promise<void>;
3
3
  //# sourceMappingURL=generateComponents.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"generateComponents.d.ts","sourceRoot":"","sources":["../../src/commands/generateComponents.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,wBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,iBAyC5C"}
@@ -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"));
9
7
  const notifyMissingPackages_1 = require("./utils/notifyMissingPackages");
10
8
  const shouldRenderComponents_1 = require("./utils/shouldRenderComponents");
11
9
  const syncAmplifyUiBuilderComponents_1 = require("./utils/syncAmplifyUiBuilderComponents");
12
10
  const createUiBuilderComponent_1 = require("./utils/createUiBuilderComponent");
13
- const run = async (context) => {
11
+ const amplify_prompts_1 = require("amplify-prompts");
12
+ const ora_1 = __importDefault(require("ora"));
13
+ async function run(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,16 +39,15 @@ const run = async (context) => {
39
39
  else {
40
40
  spinner.succeed('Synced UI components.');
41
41
  }
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);
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
+ ]);
47
46
  }
48
47
  catch (e) {
49
48
  amplify_prompts_1.printer.debug(e);
50
49
  spinner.fail('Failed to sync UI components');
51
50
  }
52
- };
51
+ }
53
52
  exports.run = run;
54
53
  //# sourceMappingURL=generateComponents.js.map
@@ -1 +1 @@
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,CAAC,+DAA+D,CAAC,CAAC;IAC/E,IAAI,CAAC,CAAC,MAAM,IAAA,+CAAsB,EA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RenderTextComponentResponse } from '@aws-amplify/codegen-ui';
1
+ import { StudioComponent, RenderTextComponentResponse } from '@aws-amplify/codegen-ui-old';
2
+ import { StudioComponent as StudioComponentNew, StudioTheme } from '@aws-amplify/codegen-ui-new';
2
3
  import { $TSContext } from 'amplify-cli-core';
3
- export declare const createUiBuilderComponent: (context: $TSContext, schema: StudioComponent) => StudioComponent;
4
+ export declare const createUiBuilderComponent: (context: $TSContext, schema: StudioComponent) => StudioComponentNew | StudioComponent;
4
5
  export declare const createUiBuilderTheme: (context: $TSContext, schema: StudioTheme) => StudioTheme;
5
- export declare const generateAmplifyUiBuilderIndexFile: (context: $TSContext, schemas: StudioComponent[]) => RenderTextComponentResponse;
6
+ export declare const generateAmplifyUiBuilderIndexFile: (context: $TSContext, schemas: StudioComponentNew[]) => RenderTextComponentResponse;
6
7
  //# 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,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
+ {"version":3,"file":"createUiBuilderComponent.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,eAAe,EAAiF,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AASzM,OAAO,EAAC,eAAe,IAAI,kBAAkB,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAG/F,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAc9C,eAAO,MAAM,wBAAwB,YAAa,UAAU,UAAU,eAAe,yCAuBpF,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAa,UAAU,UAAU,WAAW,gBAmB5E,CAAC;AAEF,eAAO,MAAM,iCAAiC,YAAa,UAAU,WAAW,kBAAkB,EAAE,gCAgBhG,CAAC"}
@@ -1,21 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateAmplifyUiBuilderIndexFile = exports.createUiBuilderTheme = exports.createUiBuilderComponent = void 0;
4
- const codegen_ui_1 = require("@aws-amplify/codegen-ui");
5
- const codegen_ui_react_1 = require("@aws-amplify/codegen-ui-react");
6
- const amplify_prompts_1 = require("amplify-prompts");
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");
7
6
  const getUiBuilderComponentsPath_1 = require("./getUiBuilderComponentsPath");
7
+ const amplify_prompts_1 = require("amplify-prompts");
8
+ const createUiBuilderComponentNew_1 = require("./createUiBuilderComponentNew");
9
+ const codegen_ui_react_new_1 = require("@aws-amplify/codegen-ui-react-new");
8
10
  const config = {
9
- module: codegen_ui_react_1.ModuleKind.ES2020,
10
- target: codegen_ui_react_1.ScriptTarget.ES2020,
11
- script: codegen_ui_react_1.ScriptKind.JSX,
11
+ module: codegen_ui_react_old_1.ModuleKind.ES2020,
12
+ target: codegen_ui_react_old_1.ScriptTarget.ES2020,
13
+ script: codegen_ui_react_old_1.ScriptKind.JSX,
12
14
  renderTypeDeclarations: true,
13
15
  };
16
+ const isUpdatedSchema = (schema) => {
17
+ return schema.schemaVersion && schema.schemaVersion === '1.0';
18
+ };
14
19
  const createUiBuilderComponent = (context, schema) => {
20
+ if (isUpdatedSchema(schema)) {
21
+ return (0, createUiBuilderComponentNew_1.createUiBuilderComponent)(context, schema);
22
+ }
15
23
  const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
16
- const rendererFactory = new codegen_ui_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_1.AmplifyRenderer(component, config));
24
+ const rendererFactory = new codegen_ui_old_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_old_1.AmplifyRenderer(component, config));
17
25
  const outputPathDir = uiBuilderComponentsPath;
18
- const rendererManager = new codegen_ui_1.StudioTemplateRendererManager(rendererFactory, {
26
+ const rendererManager = new codegen_ui_old_1.StudioTemplateRendererManager(rendererFactory, {
19
27
  outputPathDir,
20
28
  });
21
29
  rendererManager.renderSchemaToTemplate(schema);
@@ -24,9 +32,9 @@ const createUiBuilderComponent = (context, schema) => {
24
32
  exports.createUiBuilderComponent = createUiBuilderComponent;
25
33
  const createUiBuilderTheme = (context, schema) => {
26
34
  const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
27
- const rendererFactory = new codegen_ui_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_1.ReactThemeStudioTemplateRenderer(component, config));
35
+ const rendererFactory = new codegen_ui_old_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_old_1.ReactThemeStudioTemplateRenderer(component, config));
28
36
  const outputPathDir = uiBuilderComponentsPath;
29
- const rendererManager = new codegen_ui_1.StudioTemplateRendererManager(rendererFactory, {
37
+ const rendererManager = new codegen_ui_old_1.StudioTemplateRendererManager(rendererFactory, {
30
38
  outputPathDir,
31
39
  });
32
40
  try {
@@ -43,9 +51,9 @@ const createUiBuilderTheme = (context, schema) => {
43
51
  exports.createUiBuilderTheme = createUiBuilderTheme;
44
52
  const generateAmplifyUiBuilderIndexFile = (context, schemas) => {
45
53
  const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
46
- const rendererFactory = new codegen_ui_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_1.ReactIndexStudioTemplateRenderer(component, config));
54
+ const rendererFactory = new codegen_ui_old_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_new_1.ReactIndexStudioTemplateRenderer(component, config));
47
55
  const outputPathDir = uiBuilderComponentsPath;
48
- const rendererManager = new codegen_ui_1.StudioTemplateRendererManager(rendererFactory, {
56
+ const rendererManager = new codegen_ui_old_1.StudioTemplateRendererManager(rendererFactory, {
49
57
  outputPathDir,
50
58
  });
51
59
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"createUiBuilderComponent.js","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponent.ts"],"names":[],"mappings":";;;AAAA,wDAQiC;AACjC,oEAOuC;AAEvC,qDAA0C;AAE1C,6EAA0E;AAE1E,MAAM,MAAM,GAAG;IACb,MAAM,EAAE,6BAAU,CAAC,MAAM;IACzB,MAAM,EAAE,+BAAY,CAAC,MAAM;IAC3B,MAAM,EAAE,6BAAU,CAAC,GAAG;IACtB,sBAAsB,EAAE,IAAI;CAC7B,CAAC;AAKK,MAAM,wBAAwB,GAAG,CAAC,OAAmB,EAAE,MAAuB,EAAmB,EAAE;IACxG,MAAM,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,IAAI,0CAA6B,CACvD,CAAC,SAA0B,EAAE,EAAE,CAAC,IAAI,kCAAe,CAAC,SAA4B,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,eAAe,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAnBW,QAAA,wBAAwB,4BAmBnC;AAKK,MAAM,oBAAoB,GAAG,CAAC,OAAmB,EAAE,MAAmB,EAAe,EAAE;IAC5F,MAA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C,CAAC,CAAC;QACjB,yBAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,MAAM,CAAC,CAAC;KACT;AACH,CAAC,CAAC;AAxBW,QAAA,iCAAiC,qCAwB5C"}
1
+ {"version":3,"file":"createUiBuilderComponent.js","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponent.ts"],"names":[],"mappings":";;;AAAA,gEAAyM;AACzM,4EAM2C;AAG3C,6EAA0E;AAC1E,qDAA0C;AAE1C,+EAAwG;AACxG,4EAAqF;AACrF,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;AAEF,MAAM,eAAe,GAAG,CAAC,MAAuB,EAAE,EAAE;IAClD,OAAQ,MAAwC,CAAC,aAAa,IAAK,MAAwC,CAAC,aAAa,KAAK,KAAK,CAAC;AACtI,CAAC,CAAC;AAEK,MAAM,wBAAwB,GAAG,CAAC,OAAmB,EAAE,MAAuB,EAAE,EAAE;IACvF,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE;QAC3B,OAAO,IAAA,sDAA2B,EAAC,OAAO,EAAE,MAAuC,CAAC,CAAC;KACtF;IACD,MAAM,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,IAAI,8CAA6B,CACvD,CAAC,SAA0B,EAAE,EAAE,CAC7B,IAAI,sCAAe,CAAC,SAA4B,EAAE,MAAM,CAKvD,CACJ,CAAC;IAEF,MAAM,aAAa,GAAG,uBAAuB,CAAC;IAE9C,MAAM,eAAe,GAAG,IAAI,8CAA6B,CAAC,eAAe,EAAE;QACzE,aAAa;KACd,CAAC,CAAC;IAEH,eAAe,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC;AAChB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I;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;AAAA,CAAC,CAAC;AAhBQ,QAAA,iCAAiC,qCAgBzC"}
@@ -0,0 +1,5 @@
1
+ import { StudioComponent, StudioTheme } from '@aws-amplify/codegen-ui-new';
2
+ import { $TSContext } from 'amplify-cli-core';
3
+ export declare const createUiBuilderComponent: (context: $TSContext, schema: StudioComponent) => StudioComponent;
4
+ export declare const createUiBuilderTheme: (context: $TSContext, schema: StudioTheme) => StudioTheme;
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":"AAAA,OAAO,EAAgE,eAAe,EAAE,WAAW,EAA+E,MAAM,6BAA6B,CAAC;AAWtN,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQ9C,eAAO,MAAM,wBAAwB,YAAa,UAAU,UAAU,eAAe,oBAYpF,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAa,UAAU,UAAU,WAAW,gBAmB5E,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ 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 rendererManager = new codegen_ui_new_1.StudioTemplateRendererManager(rendererFactory, {
19
+ outputPathDir,
20
+ });
21
+ rendererManager.renderSchemaToTemplate(schema);
22
+ return schema;
23
+ };
24
+ exports.createUiBuilderComponent = createUiBuilderComponent;
25
+ const createUiBuilderTheme = (context, schema) => {
26
+ const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
27
+ const rendererFactory = new codegen_ui_new_1.StudioTemplateRendererFactory((component) => new codegen_ui_react_new_1.ReactThemeStudioTemplateRenderer(component, config));
28
+ const outputPathDir = uiBuilderComponentsPath;
29
+ const rendererManager = new codegen_ui_new_1.StudioTemplateRendererManager(rendererFactory, {
30
+ outputPathDir,
31
+ });
32
+ try {
33
+ rendererManager.renderSchemaToTemplate(schema);
34
+ return schema;
35
+ }
36
+ catch (e) {
37
+ amplify_prompts_1.printer.debug(e);
38
+ amplify_prompts_1.printer.debug('Skipping invalid theme with schema');
39
+ amplify_prompts_1.printer.debug(JSON.stringify(schema, null, 2));
40
+ throw e;
41
+ }
42
+ };
43
+ exports.createUiBuilderTheme = createUiBuilderTheme;
44
+ //# sourceMappingURL=createUiBuilderComponentNew.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createUiBuilderComponentNew.js","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponentNew.ts"],"names":[],"mappings":";;;AAAA,gEAAsN;AACtN,4EAO2C;AAC3C,6EAA0E;AAC1E,qDAA0C;A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AC,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;AAnBW,QAAA,oBAAoB,wBAmB/B"}
@@ -1,3 +1,4 @@
1
1
  import { $TSContext } from 'amplify-cli-core';
2
- export declare const notifyMissingPackages: (context: $TSContext) => void;
2
+ import { StudioComponent } from '@aws-amplify/codegen-ui-new';
3
+ export declare const notifyMissingPackages: (context: $TSContext, schemas: StudioComponent[]) => void;
3
4
  //# 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,EACuB,UAAU,EACvC,MAAM,kBAAkB,CAAC;AAe1B,eAAO,MAAM,qBAAqB,YAAa,UAAU,KAAG,IA8B3D,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;AAQlF,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAa9D,eAAO,MAAM,qBAAqB,YAAa,UAAU,WAAW,eAAe,EAAE,SA8BpF,CAAC"}
@@ -9,10 +9,19 @@ 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");
13
12
  const extractArgs_1 = require("./extractArgs");
14
- const getRequiredDependencies = () => new codegen_ui_react_1.ReactRequiredDependencyProvider().getRequiredDependencies();
15
- const notifyMissingPackages = (context) => {
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) => {
16
25
  var _a;
17
26
  const args = (0, extractArgs_1.extractArgs)(context);
18
27
  const localEnvFilePath = (_a = args.localEnvFilePath) !== null && _a !== void 0 ? _a : amplify_cli_core_1.pathManager.getLocalEnvFilePath();
@@ -27,7 +36,7 @@ const notifyMissingPackages = (context) => {
27
36
  return;
28
37
  }
29
38
  const packageJson = amplify_cli_core_1.JSONUtilities.readJson(packageJsonPath);
30
- getRequiredDependencies().forEach((dependency) => {
39
+ getRequiredDependencies(schemas).forEach((dependency) => {
31
40
  const packageIsInstalled = Object.keys(packageJson.dependencies).includes(dependency.dependencyName);
32
41
  if (!packageIsInstalled) {
33
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}`);
@@ -1 +1 @@
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,uB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AC;AA9BW,QAAA,qBAAqB,yBA8BhC"}
@@ -7,7 +7,7 @@ export declare function listUiBuilderComponents(context: $TSContext, envName?: s
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").StudioComponent;
10
+ component: import("@aws-amplify/codegen-ui-new").StudioComponent | import("@aws-amplify/codegen-ui-old").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").StudioTheme;
21
+ theme: import("@aws-amplify/codegen-ui-new").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.16-pin-codegen-dependency.0",
3
+ "version": "1.2.16",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -13,15 +13,17 @@
13
13
  "access": "public"
14
14
  },
15
15
  "dependencies": {
16
- "@aws-amplify/codegen-ui": "2.1.2",
17
- "@aws-amplify/codegen-ui-react": "2.1.2",
18
- "@types/fs-extra": "^8.0.1",
19
- "@types/semver": "^7.1.0",
20
- "amplify-cli-core": "2.4.18-pin-codegen-dependency.0",
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",
20
+ "amplify-cli-core": "2.4.18",
21
21
  "amplify-prompts": "1.6.3",
22
- "amplify-provider-awscloudformation": "5.9.10-pin-codegen-dependency.0",
23
- "aws-sdk": "2.1084.0",
24
- "ora": "^4.0.3"
22
+ "amplify-provider-awscloudformation": "5.9.10",
23
+ "aws-sdk": "2.1084.0"
24
+ },
25
+ "devDependencies": {
26
+ "@aws-amplify/codegen-ui": "2.1.0"
25
27
  },
26
28
  "jest": {
27
29
  "testRunner": "jest-circus/runner",
@@ -58,5 +60,5 @@
58
60
  "usePathForSuiteName": "true",
59
61
  "addFileAttribute": "true"
60
62
  },
61
- "gitHead": "04d7b3f7c3ec5a3ac95968a05a3a963832ac9b6f"
63
+ "gitHead": "f4fca61223f56eb79e6363d32fc16083fd043759"
62
64
  }
@@ -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
 
@@ -33,8 +33,6 @@ describe('can generate components', () => {
33
33
  {
34
34
  resultType: 'SUCCESS',
35
35
  schemaName: 'testSchema',
36
- name: 'testSchema',
37
- schemaVersion: '1.0',
38
36
  },
39
37
  ],
40
38
  };
@@ -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,7 +1,3 @@
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';
5
1
  import { notifyMissingPackages } from './utils/notifyMissingPackages';
6
2
  import { shouldRenderComponents } from './utils/shouldRenderComponents';
7
3
  import {
@@ -10,12 +6,13 @@ import {
10
6
  generateUiBuilderComponents,
11
7
  generateUiBuilderThemes,
12
8
  } from './utils/syncAmplifyUiBuilderComponents';
9
+ import { StudioComponent as StudioComponentNew } from '@aws-amplify/codegen-ui-new';
13
10
  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
- /**
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> => {
15
+ export async function run(context: $TSContext) {
19
16
  printer.debug('Running generate components command in amplify-util-uibuilder');
20
17
  if (!(await shouldRenderComponents(context))) {
21
18
  return;
@@ -35,7 +32,7 @@ export const run = async (context: $TSContext): Promise<void> => {
35
32
  generateAmplifyUiBuilderIndexFile(context, [
36
33
  ...generatedComponentResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ component }) => component),
37
34
  ...generatedThemeResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ theme }) => theme),
38
- ] as StudioComponent[]);
35
+ ] as StudioComponentNew[]);
39
36
 
40
37
  const failedSchemas = [
41
38
  ...generatedComponentResults.filter(({ resultType }) => resultType === 'FAILURE').map(({ schemaName }) => schemaName),
@@ -48,14 +45,12 @@ export const run = async (context: $TSContext): Promise<void> => {
48
45
  spinner.succeed('Synced UI components.');
49
46
  }
50
47
 
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);
48
+ notifyMissingPackages(context, [
49
+ ...generatedComponentResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ component }) => component),
50
+ ...generatedThemeResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ theme }) => theme),
51
+ ] as StudioComponentNew[]);
57
52
  } catch (e) {
58
53
  printer.debug(e);
59
54
  spinner.fail('Failed to sync UI components');
60
55
  }
61
- };
56
+ }
@@ -1,25 +1,18 @@
1
- import {
2
- StudioTemplateRendererManager,
3
- StudioComponent,
4
- StudioTheme,
5
- StudioTemplateRendererFactory,
6
- StudioTemplateRenderer,
7
- FrameworkOutputManager,
8
- RenderTextComponentResponse,
9
- } from '@aws-amplify/codegen-ui';
1
+ import { StudioTemplateRendererManager, StudioComponent, StudioTemplateRendererFactory, StudioTemplateRenderer, FrameworkOutputManager, RenderTextComponentResponse } from '@aws-amplify/codegen-ui-old';
10
2
  import {
11
3
  AmplifyRenderer,
12
4
  ReactThemeStudioTemplateRenderer,
13
- ReactIndexStudioTemplateRenderer,
14
5
  ModuleKind,
15
6
  ScriptTarget,
16
7
  ScriptKind,
17
- } from '@aws-amplify/codegen-ui-react';
8
+ } from '@aws-amplify/codegen-ui-react-old';
18
9
 
10
+ import {StudioComponent as StudioComponentNew, StudioTheme} from '@aws-amplify/codegen-ui-new';
11
+ import { getUiBuilderComponentsPath } from './getUiBuilderComponentsPath';
19
12
  import { printer } from 'amplify-prompts';
20
13
  import { $TSContext } from 'amplify-cli-core';
21
- import { getUiBuilderComponentsPath } from './getUiBuilderComponentsPath';
22
-
14
+ import { createUiBuilderComponent as createUiBuilderComponentNew } from './createUiBuilderComponentNew';
15
+ import { ReactIndexStudioTemplateRenderer } from '@aws-amplify/codegen-ui-react-new';
23
16
  const config = {
24
17
  module: ModuleKind.ES2020,
25
18
  target: ScriptTarget.ES2020,
@@ -27,13 +20,18 @@ const config = {
27
20
  renderTypeDeclarations: true,
28
21
  };
29
22
 
30
- /**
31
- * Writes component file to the work space
32
- */
33
- export const createUiBuilderComponent = (context: $TSContext, schema: StudioComponent): StudioComponent => {
23
+ const isUpdatedSchema = (schema: StudioComponent) => {
24
+ return (schema as unknown as StudioComponentNew).schemaVersion && (schema as unknown as StudioComponentNew).schemaVersion === '1.0';
25
+ };
26
+
27
+ export const createUiBuilderComponent = (context: $TSContext, schema: StudioComponent) => {
28
+ if (isUpdatedSchema(schema)) {
29
+ return createUiBuilderComponentNew(context, schema as unknown as StudioComponentNew);
30
+ }
34
31
  const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
35
32
  const rendererFactory = new StudioTemplateRendererFactory(
36
- (component: StudioComponent) => new AmplifyRenderer(component as StudioComponent, config) as unknown as StudioTemplateRenderer<
33
+ (component: StudioComponent) =>
34
+ new AmplifyRenderer(component as StudioComponent, config) as unknown as StudioTemplateRenderer<
37
35
  unknown,
38
36
  StudioComponent,
39
37
  FrameworkOutputManager<unknown>,
@@ -51,19 +49,9 @@ export const createUiBuilderComponent = (context: $TSContext, schema: StudioComp
51
49
  return schema;
52
50
  };
53
51
 
54
- /**
55
- * Writes theme file to the work space
56
- */
57
- export const createUiBuilderTheme = (context: $TSContext, schema: StudioTheme): StudioTheme => {
52
+ export const createUiBuilderTheme = (context: $TSContext, schema: StudioTheme) => {
58
53
  const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
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
- );
54
+ const rendererFactory = new StudioTemplateRendererFactory((component: StudioTheme) => new ReactThemeStudioTemplateRenderer(component, config) as unknown as StudioTemplateRenderer<unknown, StudioTheme, FrameworkOutputManager<unknown>, RenderTextComponentResponse>);
67
55
 
68
56
  const outputPathDir = uiBuilderComponentsPath;
69
57
 
@@ -82,19 +70,9 @@ export const createUiBuilderTheme = (context: $TSContext, schema: StudioTheme):
82
70
  }
83
71
  };
84
72
 
85
- /**
86
- * Writes index file to the work space
87
- */
88
- export const generateAmplifyUiBuilderIndexFile = (context: $TSContext, schemas: StudioComponent[]): RenderTextComponentResponse => {
73
+ export const generateAmplifyUiBuilderIndexFile = (context: $TSContext, schemas: StudioComponentNew[]) => {
89
74
  const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
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
- );
75
+ const rendererFactory = new StudioTemplateRendererFactory((component: StudioComponentNew[]) => new ReactIndexStudioTemplateRenderer(component, config) as unknown as StudioTemplateRenderer<unknown, StudioComponentNew[], FrameworkOutputManager<unknown>, RenderTextComponentResponse>);
98
76
 
99
77
  const outputPathDir = uiBuilderComponentsPath;
100
78
 
@@ -108,5 +86,4 @@ export const generateAmplifyUiBuilderIndexFile = (context: $TSContext, schemas:
108
86
  printer.debug(e);
109
87
  printer.debug('Failed to generate component index file');
110
88
  throw e;
111
- }
112
- };
89
+ }};