@aws-amplify/amplify-util-uibuilder 1.2.13 → 1.2.15-beta.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 CHANGED
@@ -3,6 +3,25 @@
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.15-beta.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.2.14...@aws-amplify/amplify-util-uibuilder@1.2.15-beta.0) (2022-03-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * uibuilder e2e tests ([#9922](https://github.com/aws-amplify/amplify-cli/issues/9922)) ([11d172b](https://github.com/aws-amplify/amplify-cli/commit/11d172bf7c9acca5c6a20cdfd49818aadfc13f04))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.2.14](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.2.13...@aws-amplify/amplify-util-uibuilder@1.2.14) (2022-02-25)
18
+
19
+ **Note:** Version bump only for package @aws-amplify/amplify-util-uibuilder
20
+
21
+
22
+
23
+
24
+
6
25
  ## [1.2.13](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.2.12...@aws-amplify/amplify-util-uibuilder@1.2.13) (2022-02-18)
7
26
 
8
27
  **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,iBAsC5C"}
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"}
@@ -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;Y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AC,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;SAChF,CAAC,CAAC;KAC5B;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,7 @@
1
+ import { StudioComponent, RenderTextComponentResponse } from '@aws-amplify/codegen-ui-old';
2
+ import { StudioComponent as StudioComponentNew, StudioTheme } from '@aws-amplify/codegen-ui-new';
1
3
  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").RenderTextComponentResponse;
4
+ export declare const createUiBuilderComponent: (context: $TSContext, schema: StudioComponent) => StudioComponentNew | StudioComponent;
5
+ export declare const createUiBuilderTheme: (context: $TSContext, schema: StudioTheme) => StudioTheme;
6
+ export declare const generateAmplifyUiBuilderIndexFile: (context: $TSContext, schemas: StudioComponentNew[]) => RenderTextComponentResponse;
5
7
  //# sourceMappingURL=createUiBuilderComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createUiBuilderComponent.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponent.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,kEAkBpF,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,36 +1,42 @@
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");
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");
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 outputConfig = {
26
+ const rendererManager = new codegen_ui_old_1.StudioTemplateRendererManager(rendererFactory, {
19
27
  outputPathDir,
20
- };
21
- const rendererManager = new codegen_ui_1.StudioTemplateRendererManager(rendererFactory, outputConfig);
28
+ });
22
29
  rendererManager.renderSchemaToTemplate(schema);
23
30
  return schema;
24
31
  };
25
32
  exports.createUiBuilderComponent = createUiBuilderComponent;
26
33
  const createUiBuilderTheme = (context, schema) => {
27
34
  const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
28
- 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));
29
36
  const outputPathDir = uiBuilderComponentsPath;
30
- const outputConfig = {
37
+ const rendererManager = new codegen_ui_old_1.StudioTemplateRendererManager(rendererFactory, {
31
38
  outputPathDir,
32
- };
33
- const rendererManager = new codegen_ui_1.StudioTemplateRendererManager(rendererFactory, outputConfig);
39
+ });
34
40
  try {
35
41
  rendererManager.renderSchemaToTemplate(schema);
36
42
  return schema;
@@ -45,12 +51,11 @@ const createUiBuilderTheme = (context, schema) => {
45
51
  exports.createUiBuilderTheme = createUiBuilderTheme;
46
52
  const generateAmplifyUiBuilderIndexFile = (context, schemas) => {
47
53
  const uiBuilderComponentsPath = (0, getUiBuilderComponentsPath_1.getUiBuilderComponentsPath)(context);
48
- 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));
49
55
  const outputPathDir = uiBuilderComponentsPath;
50
- const outputConfig = {
56
+ const rendererManager = new codegen_ui_old_1.StudioTemplateRendererManager(rendererFactory, {
51
57
  outputPathDir,
52
- };
53
- const rendererManager = new codegen_ui_1.StudioTemplateRendererManager(rendererFactory, outputConfig);
58
+ });
54
59
  try {
55
60
  return rendererManager.renderSchemaToTemplate(schemas);
56
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createUiBuilderComponent.js","sourceRoot":"","sources":["../../../src/commands/utils/createUiBuilderComponent.ts"],"names":[],"mappings":";;;AAAA,wDAAwH;AACxH,oEAOuC;AACvC,6EAA0E;AAC1E,qDAA0C;AAE1C,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;AAEK,MAAM,wBAAwB,GAAG,CAAC,OAAmB,EAAE,MAAW,EAAE,EAAE;IAC3E,MAAM,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,OAAO,CA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B,wBAoB/B;AAEK,MAAM,iCAAiC,GAAG,CAAC,OAAmB,EAAE,OAAc,EAAE,EAAE;IACvF,MAAM,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,IAAI,0CAA6B,CAAC,CAAC,SAAc,EAAE,EAAE,CAAC,IAAI,mDAAgC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvI,MAAM,aAAa,GAAG,uBAAuB,CAAC;IAC9C,MAAM,YAAY,GAAG;QACnB,aAAa;KACd,CAAC;IAEF,MAAM,eAAe,GAAG,IAAI,0CAA6B,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
+ {"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,wBA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AAC,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;AAEK,MAAM,iCAAiC,GAAG,CAAC,OAAmB,EAAE,OAA6B,EAAE,EAAE;IACtG,MAAM,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,IAAI,8CAA6B,CAAC,CAAC,SAA+B,EAAE,EAAE,CAAC,IAAI,uDAAgC,CAAC,SAAS,EAAE,MAAM,CAAmI,CAAC,CAAC;IAE1R,MAAM,aAAa,GAAG,uBAAuB,CAAC;IAE9C,MAAM,eAAe,GAAG,IAAI,8CAA6B,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;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;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,MAAuB,EAAE,EAAE;IACvF,MAAM,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,IAAI,8CAA6B,CAAC,CAAC,SAA0B,EAAE,EAAE,CAAC,IAAI,sCAAe,CAAC,SAAS,EAAE,MAAM,CAA8H,CAAC,CAAC;IAE/P,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,CAAC,CAAC;AAZW,QAAA,wBAAwB,4BAYnC;AAEK,MAAM,oBAAoB,GAAG,CAAC,OAAmB,EAAE,MAAmB,EAAE,EAAE;IAC/E,MAAM,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,IAAI,8CAA6B,CAAC,CAAC,SAAsB,EAAE,EAAE,CAAC,IAAI,uDAAgC,CAAC,SAAS,EAAE,MAAM,CAA0H,CAAC,CAAC;IAExQ,MAAM,aAAa,GAAG,uBAAuB,CAAC;IAE9C,MAAM,eAAe,GAAG,IAAI,8CAA6B,CAAC,eAAe,EAAE;QACzE,aAAa;KACd,CAAC,CAAC;IAEH,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;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,EAA8B,UAAU,EAAU,MAAM,kBAAkB,CAAC;AAOlF,eAAO,MAAM,qBAAqB,YAAa,UAAU,SAwBxD,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"}
@@ -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 REQUIRED_PACKAGES = { '@aws-amplify/ui-react': '*', 'aws-amplify': '*' };
13
- 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) => {
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
- Object.keys(REQUIRED_PACKAGES).forEach(packageName => {
29
- const packageIsInstalled = Object.keys(packageJson.dependencies).includes(packageName);
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 "${packageName}" that is not in your package.json. Run \`npm install ${packageName}\``);
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 (!packageVersionMatches(REQUIRED_PACKAGES[packageName], packageJson.dependencies[packageName])) {
34
- amplify_prompts_1.printer.warn(`UIBuilder components requires version "${REQUIRED_PACKAGES[packageName]}" of "${packageName}". You currently are on version "${packageJson.dependencies[packageName]}".`);
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,iBAAiB,GAA8B,EAAE,uBAAuB,EAAE,GA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H,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;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: any;
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: any;
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.13",
3
+ "version": "1.2.15-beta.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -13,12 +13,17 @@
13
13
  "access": "public"
14
14
  },
15
15
  "dependencies": {
16
- "@aws-amplify/codegen-ui": "1.2.0",
17
- "@aws-amplify/codegen-ui-react": "1.2.0",
18
- "amplify-cli-core": "2.4.15",
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.17-beta.0",
19
21
  "amplify-prompts": "1.6.3",
20
- "amplify-provider-awscloudformation": "5.9.7",
21
- "aws-sdk": "^2.1042.0"
22
+ "amplify-provider-awscloudformation": "5.9.9-beta.0",
23
+ "aws-sdk": "2.1084.0"
24
+ },
25
+ "devDependencies": {
26
+ "@aws-amplify/codegen-ui": "2.1.0"
22
27
  },
23
28
  "jest": {
24
29
  "testRunner": "jest-circus/runner",
@@ -55,5 +60,5 @@
55
60
  "usePathForSuiteName": "true",
56
61
  "addFileAttribute": "true"
57
62
  },
58
- "gitHead": "cc9d818cb53de5ab78f242b51fe7d95ba557ccc0"
63
+ "gitHead": "73037acfc78a75529a6de1bfd33adccd653ddc70"
59
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
 
@@ -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 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 any);
42
+ notifyMissingPackages(context as JSONUtilitiesDependency.$TSContext, []);
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(2);
54
+ notifyMissingPackages(context as JSONUtilitiesDependency.$TSContext, []);
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 JSONUtilitiesDependency.$TSContext, []);
71
71
  expect(printerDependency.printer.warn).toBeCalledTimes(1);
72
72
  });
73
73
  });
@@ -6,6 +6,7 @@ import {
6
6
  generateUiBuilderComponents,
7
7
  generateUiBuilderThemes,
8
8
  } from './utils/syncAmplifyUiBuilderComponents';
9
+ import { StudioComponent as StudioComponentNew } from '@aws-amplify/codegen-ui-new';
9
10
  import { generateAmplifyUiBuilderIndexFile } from './utils/createUiBuilderComponent';
10
11
  import { printer } from 'amplify-prompts';
11
12
  import ora from 'ora';
@@ -31,7 +32,7 @@ export async function run(context: $TSContext) {
31
32
  generateAmplifyUiBuilderIndexFile(context, [
32
33
  ...generatedComponentResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ component }) => component),
33
34
  ...generatedThemeResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ theme }) => theme),
34
- ]);
35
+ ] as StudioComponentNew[]);
35
36
 
36
37
  const failedSchemas = [
37
38
  ...generatedComponentResults.filter(({ resultType }) => resultType === 'FAILURE').map(({ schemaName }) => schemaName),
@@ -43,10 +44,13 @@ export async function run(context: $TSContext) {
43
44
  } else {
44
45
  spinner.succeed('Synced UI components.');
45
46
  }
47
+
48
+ notifyMissingPackages(context, [
49
+ ...generatedComponentResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ component }) => component),
50
+ ...generatedThemeResults.filter(({ resultType }) => resultType === 'SUCCESS').map(({ theme }) => theme),
51
+ ] as StudioComponentNew[]);
46
52
  } catch (e) {
47
53
  printer.debug(e);
48
54
  spinner.fail('Failed to sync UI components');
49
55
  }
50
-
51
- notifyMissingPackages(context);
52
56
  }
@@ -1,15 +1,18 @@
1
- import { StudioTemplateRendererManager, StudioTemplateRendererFactory, StudioComponent } from '@aws-amplify/codegen-ui';
1
+ import { StudioTemplateRendererManager, StudioComponent, StudioTemplateRendererFactory, StudioTemplateRenderer, FrameworkOutputManager, RenderTextComponentResponse } 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';
9
+
10
+ import {StudioComponent as StudioComponentNew, StudioTheme} from '@aws-amplify/codegen-ui-new';
10
11
  import { getUiBuilderComponentsPath } from './getUiBuilderComponentsPath';
11
12
  import { printer } from 'amplify-prompts';
12
13
  import { $TSContext } from 'amplify-cli-core';
14
+ import { createUiBuilderComponent as createUiBuilderComponentNew } from './createUiBuilderComponentNew';
15
+ import { ReactIndexStudioTemplateRenderer } from '@aws-amplify/codegen-ui-react-new';
13
16
  const config = {
14
17
  module: ModuleKind.ES2020,
15
18
  target: ScriptTarget.ES2020,
@@ -17,31 +20,44 @@ const config = {
17
20
  renderTypeDeclarations: true,
18
21
  };
19
22
 
20
- export const createUiBuilderComponent = (context: $TSContext, schema: any) => {
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
+ }
21
31
  const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
22
- const rendererFactory = new StudioTemplateRendererFactory((component: StudioComponent) => new AmplifyRenderer(component, config));
32
+ const rendererFactory = new StudioTemplateRendererFactory(
33
+ (component: StudioComponent) =>
34
+ new AmplifyRenderer(component as StudioComponent, config) as unknown as StudioTemplateRenderer<
35
+ unknown,
36
+ StudioComponent,
37
+ FrameworkOutputManager<unknown>,
38
+ RenderTextComponentResponse
39
+ >,
40
+ );
23
41
 
24
42
  const outputPathDir = uiBuilderComponentsPath;
25
- const outputConfig = {
26
- outputPathDir,
27
- };
28
43
 
29
- const rendererManager = new StudioTemplateRendererManager(rendererFactory, outputConfig);
44
+ const rendererManager = new StudioTemplateRendererManager(rendererFactory, {
45
+ outputPathDir,
46
+ });
30
47
 
31
48
  rendererManager.renderSchemaToTemplate(schema);
32
49
  return schema;
33
50
  };
34
51
 
35
- export const createUiBuilderTheme = (context: $TSContext, schema: any) => {
52
+ export const createUiBuilderTheme = (context: $TSContext, schema: StudioTheme) => {
36
53
  const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
37
- const rendererFactory = new StudioTemplateRendererFactory((component: any) => new ReactThemeStudioTemplateRenderer(component, config));
54
+ const rendererFactory = new StudioTemplateRendererFactory((component: StudioTheme) => new ReactThemeStudioTemplateRenderer(component, config) as unknown as StudioTemplateRenderer<unknown, StudioTheme, FrameworkOutputManager<unknown>, RenderTextComponentResponse>);
38
55
 
39
56
  const outputPathDir = uiBuilderComponentsPath;
40
- const outputConfig = {
41
- outputPathDir,
42
- };
43
57
 
44
- const rendererManager = new StudioTemplateRendererManager(rendererFactory, outputConfig);
58
+ const rendererManager = new StudioTemplateRendererManager(rendererFactory, {
59
+ outputPathDir,
60
+ });
45
61
 
46
62
  try {
47
63
  rendererManager.renderSchemaToTemplate(schema);
@@ -54,16 +70,15 @@ export const createUiBuilderTheme = (context: $TSContext, schema: any) => {
54
70
  }
55
71
  };
56
72
 
57
- export const generateAmplifyUiBuilderIndexFile = (context: $TSContext, schemas: any[]) => {
73
+ export const generateAmplifyUiBuilderIndexFile = (context: $TSContext, schemas: StudioComponentNew[]) => {
58
74
  const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
59
- const rendererFactory = new StudioTemplateRendererFactory((component: any) => new ReactIndexStudioTemplateRenderer(component, config));
75
+ const rendererFactory = new StudioTemplateRendererFactory((component: StudioComponentNew[]) => new ReactIndexStudioTemplateRenderer(component, config) as unknown as StudioTemplateRenderer<unknown, StudioComponentNew[], FrameworkOutputManager<unknown>, RenderTextComponentResponse>);
60
76
 
61
77
  const outputPathDir = uiBuilderComponentsPath;
62
- const outputConfig = {
63
- outputPathDir,
64
- };
65
78
 
66
- const rendererManager = new StudioTemplateRendererManager(rendererFactory, outputConfig);
79
+ const rendererManager = new StudioTemplateRendererManager(rendererFactory, {
80
+ outputPathDir,
81
+ });
67
82
 
68
83
  try {
69
84
  return rendererManager.renderSchemaToTemplate(schemas);
@@ -71,5 +86,4 @@ export const generateAmplifyUiBuilderIndexFile = (context: $TSContext, schemas:
71
86
  printer.debug(e);
72
87
  printer.debug('Failed to generate component index file');
73
88
  throw e;
74
- }
75
- };
89
+ }};
@@ -0,0 +1,53 @@
1
+ import { StudioTemplateRendererManager, StudioTemplateRendererFactory, StudioComponent, StudioTheme, StudioTemplateRenderer, FrameworkOutputManager, RenderTextComponentResponse } 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: StudioComponent) => {
21
+ const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
22
+ const rendererFactory = new StudioTemplateRendererFactory((component: StudioComponent) => new AmplifyRenderer(component, config) as unknown as StudioTemplateRenderer<unknown, StudioComponent, FrameworkOutputManager<unknown>, RenderTextComponentResponse>);
23
+
24
+ const outputPathDir = uiBuilderComponentsPath;
25
+
26
+ const rendererManager = new StudioTemplateRendererManager(rendererFactory, {
27
+ outputPathDir,
28
+ });
29
+
30
+ rendererManager.renderSchemaToTemplate(schema);
31
+ return schema;
32
+ };
33
+
34
+ export const createUiBuilderTheme = (context: $TSContext, schema: StudioTheme) => {
35
+ const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
36
+ const rendererFactory = new StudioTemplateRendererFactory((component: StudioTheme) => new ReactThemeStudioTemplateRenderer(component, config) as unknown as StudioTemplateRenderer<unknown, StudioTheme, FrameworkOutputManager<unknown>, RenderTextComponentResponse>);
37
+
38
+ const outputPathDir = uiBuilderComponentsPath;
39
+
40
+ const rendererManager = new StudioTemplateRendererManager(rendererFactory, {
41
+ outputPathDir,
42
+ });
43
+
44
+ try {
45
+ rendererManager.renderSchemaToTemplate(schema);
46
+ return schema;
47
+ } catch (e) {
48
+ printer.debug(e);
49
+ printer.debug('Skipping invalid theme with schema');
50
+ printer.debug(JSON.stringify(schema, null, 2));
51
+ throw e;
52
+ }
53
+ };