@webiny/cli 5.17.4-beta.1 → 5.18.0-beta.2

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 (49) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/commands/upgrade/index.js +60 -11
  3. package/context.js +1 -2
  4. package/package.json +4 -15
  5. package/utils/getProjectApplication.js +25 -2
  6. package/utils/log.js +2 -2
  7. package/commands/upgrade/upgrades/5.10.0/index.js +0 -123
  8. package/commands/upgrade/upgrades/5.10.0/upgradeApiFileManager.js +0 -111
  9. package/commands/upgrade/upgrades/5.10.0/upgradeApolloCachePlugins.js +0 -114
  10. package/commands/upgrade/upgrades/5.10.0/upgradeDeliveryPath.js +0 -19
  11. package/commands/upgrade/upgrades/5.10.0/upgradeLambdaConfig.js +0 -30
  12. package/commands/upgrade/upgrades/5.11.0/index.js +0 -109
  13. package/commands/upgrade/upgrades/5.11.0/upgradeApiI18n.js +0 -59
  14. package/commands/upgrade/upgrades/5.11.0/upgradeObjectField.js +0 -59
  15. package/commands/upgrade/upgrades/5.11.0/upgradeWebsite.js +0 -21
  16. package/commands/upgrade/upgrades/5.12.0/index.js +0 -106
  17. package/commands/upgrade/upgrades/5.12.0/upgradeApiSecurity.js +0 -53
  18. package/commands/upgrade/upgrades/5.12.0/upgradeElasticsearch.js +0 -111
  19. package/commands/upgrade/upgrades/5.13.0/addDotWebinyToGitIgnore.js +0 -25
  20. package/commands/upgrade/upgrades/5.13.0/addNewScaffolds.js +0 -75
  21. package/commands/upgrade/upgrades/5.13.0/createTypesTsFiles.js +0 -101
  22. package/commands/upgrade/upgrades/5.13.0/files/types/graphql.ts +0 -34
  23. package/commands/upgrade/upgrades/5.13.0/files/types/headlessCMS.ts +0 -28
  24. package/commands/upgrade/upgrades/5.13.0/index.js +0 -49
  25. package/commands/upgrade/upgrades/5.15.0/index.js +0 -97
  26. package/commands/upgrade/upgrades/5.15.0/upgradeApiPageBuilder.js +0 -121
  27. package/commands/upgrade/upgrades/5.16.0/index.js +0 -207
  28. package/commands/upgrade/upgrades/5.17.0/apiPrerenderingService.js +0 -182
  29. package/commands/upgrade/upgrades/5.17.0/index.js +0 -93
  30. package/commands/upgrade/upgrades/5.17.0/security.js +0 -611
  31. package/commands/upgrade/upgrades/5.5.0/index.js +0 -426
  32. package/commands/upgrade/upgrades/5.5.0/templates/api/default.webiny.config.js +0 -8
  33. package/commands/upgrade/upgrades/5.5.0/templates/api/fileManagerTransform.webiny.config.js +0 -9
  34. package/commands/upgrade/upgrades/5.5.0/templates/api/prerenderingService.webiny.config.js +0 -30
  35. package/commands/upgrade/upgrades/5.5.0/templates/customPackages/webiny.config.js +0 -8
  36. package/commands/upgrade/upgrades/5.5.0/templates/webinyApplication/api/webiny.application.js +0 -9
  37. package/commands/upgrade/upgrades/5.5.0/templates/webinyApplication/apps/admin/webiny.application.js +0 -15
  38. package/commands/upgrade/upgrades/5.5.0/templates/webinyApplication/apps/site/webiny.application.js +0 -16
  39. package/commands/upgrade/upgrades/5.5.0/templates/webinyApplication/apps/website/webiny.application.js +0 -16
  40. package/commands/upgrade/upgrades/5.8.0/index.js +0 -137
  41. package/commands/upgrade/upgrades/5.9.0/index.js +0 -144
  42. package/commands/upgrade/upgrades/5.9.0/upgradeScaffolding/babelrc.js +0 -1
  43. package/commands/upgrade/upgrades/5.9.0/upgradeScaffolding/jestConfig.js +0 -40
  44. package/commands/upgrade/upgrades/5.9.0/upgradeScaffolding.js +0 -337
  45. package/commands/upgrade/upgrades/5.9.0/upgradeSecurity.js +0 -280
  46. package/commands/upgrade/upgrades/5.9.0/upgradeTelemetry.js +0 -30
  47. package/commands/upgrade/upgrades/fileUtils.js +0 -152
  48. package/commands/upgrade/upgrades/upgrade.js +0 -1
  49. package/commands/upgrade/upgrades/utils.js +0 -792
@@ -1,101 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
-
4
- const createTypesTsFiles = async context => {
5
- const { info, project, version } = context;
6
-
7
- const { addPackagesToDependencies } = require("../utils");
8
-
9
- info(`Creating new ${info.hl("types.ts")} files...`);
10
-
11
- {
12
- const src = path.join(__dirname, "files", "types", "graphql.ts");
13
- const destFolder = path.join(project.root, "api", "code", "graphql", "src");
14
- const dest = path.join(destFolder, "types.ts");
15
-
16
- if (fs.existsSync(destFolder)) {
17
- fs.copyFileSync(src, dest);
18
- info(`${info.hl(dest)} created.`);
19
-
20
- // These types.ts include additional packages. Let's add them to dependencies.
21
- const packageJsonFolder = path.join(project.root, "api", "code", "graphql");
22
-
23
- info(`Updating dependencies in ${info.hl(packageJsonFolder)}...`);
24
-
25
- if (fs.existsSync(packageJsonFolder)) {
26
- const packages = {
27
- "@webiny/handler": version,
28
- "@webiny/handler-http": version,
29
- "@webiny/handler-args": version,
30
- "@webiny/handler-client": version,
31
- "@webiny/api-elasticsearch": version,
32
- "@webiny/api-tenancy": version,
33
- "@webiny/api-security": version,
34
- "@webiny/api-i18n": version,
35
- "@webiny/api-i18n-content": version,
36
- "@webiny/api-page-builder": version,
37
- "@webiny/api-prerendering-service": version,
38
- "@webiny/api-file-manager": version,
39
- "@webiny/api-form-builder": version
40
- };
41
-
42
- addPackagesToDependencies(packageJsonFolder, packages);
43
- info(`Dependencies in ${info.hl(packageJsonFolder)} successfully updated.`);
44
- } else {
45
- info(
46
- `Could not update dependencies in ${info.hl(
47
- packageJsonFolder
48
- )} - file does not exist.`
49
- );
50
- }
51
- } else {
52
- info(`Could not create ${info.hl(dest)}, folder does not exist.`);
53
- }
54
- }
55
-
56
- {
57
- const src = path.join(__dirname, "files", "types", "headlessCMS.ts");
58
- const destFolder = path.join(project.root, "api", "code", "headlessCMS", "src");
59
- const dest = path.join(destFolder, "types.ts");
60
-
61
- if (fs.existsSync(destFolder)) {
62
- fs.copyFileSync(src, dest);
63
- info(`${info.hl(dest)} created.`);
64
-
65
- // These types.ts include additional packages. Let's add them to dependencies.
66
- const packageJsonFolder = path.join(project.root, "api", "code", "headlessCMS");
67
-
68
- info(`Updating dependencies in ${info.hl(packageJsonFolder)}...`);
69
-
70
- if (fs.existsSync(packageJsonFolder)) {
71
- const packages = {
72
- "@webiny/handler": version,
73
- "@webiny/handler-http": version,
74
- "@webiny/handler-args": version,
75
- "@webiny/handler-client": version,
76
- "@webiny/api-elasticsearch": version,
77
- "@webiny/api-security": version,
78
- "@webiny/api-i18n": version,
79
- "@webiny/api-i18n-content": version,
80
- "@webiny/api-tenancy": version,
81
- "@webiny/api-headless-cms": version
82
- };
83
-
84
- addPackagesToDependencies(packageJsonFolder, packages);
85
- info(`Dependencies in ${info.hl(packageJsonFolder)} successfully updated.`);
86
- } else {
87
- info(
88
- `Could not update dependencies in ${info.hl(
89
- packageJsonFolder
90
- )} - file does not exist.`
91
- );
92
- }
93
- } else {
94
- info(`Could not create ${info.hl(dest)}, folder does not exist.`);
95
- }
96
- }
97
- };
98
-
99
- module.exports = {
100
- createTypesTsFiles
101
- };
@@ -1,34 +0,0 @@
1
- import { HandlerContext } from "@webiny/handler/types";
2
- import { HttpContext } from "@webiny/handler-http/types";
3
- import { ArgsContext } from "@webiny/handler-args/types";
4
- import { ClientContext } from "@webiny/handler-client/types";
5
- import { ElasticsearchContext } from "@webiny/api-elasticsearch/types";
6
- import { TenancyContext } from "@webiny/api-tenancy/types";
7
- import { SecurityContext } from "@webiny/api-security/types";
8
- import { I18NContext } from "@webiny/api-i18n/types";
9
- import { BaseI18NContentContext as I18NContentContext } from "@webiny/api-i18n-content/types";
10
- import { PbContext } from "@webiny/api-page-builder/graphql/types";
11
- import { PrerenderingServiceClientContext } from "@webiny/api-prerendering-service/client/types";
12
- import { FileManagerContext } from "@webiny/api-file-manager/types";
13
- import { FormBuilderContext } from "@webiny/api-form-builder/types";
14
-
15
- // When working with the `context` object (for example while defining a new GraphQL resolver function),
16
- // you can import this interface and assign it to it. This will give you full autocomplete functionality
17
- // and type safety. The easiest way to import it would be via the following import statement:
18
- // import { Context } from "~/types";
19
- // Feel free to extend it with additional context interfaces, if needed. Also, please do not change the
20
- // name of the interface, as existing scaffolding utilities may rely on it during the scaffolding process.
21
- export interface Context
22
- extends HandlerContext,
23
- HttpContext,
24
- ArgsContext,
25
- ClientContext,
26
- ElasticsearchContext,
27
- TenancyContext,
28
- SecurityContext,
29
- I18NContext,
30
- I18NContentContext,
31
- PbContext,
32
- PrerenderingServiceClientContext,
33
- FileManagerContext,
34
- FormBuilderContext {}
@@ -1,28 +0,0 @@
1
- import { HandlerContext } from "@webiny/handler/types";
2
- import { HttpContext } from "@webiny/handler-http/types";
3
- import { ArgsContext } from "@webiny/handler-args/types";
4
- import { ClientContext } from "@webiny/handler-client/types";
5
- import { ElasticsearchContext } from "@webiny/api-elasticsearch/types";
6
- import { SecurityContext } from "@webiny/api-security/types";
7
- import { I18NContext } from "@webiny/api-i18n/types";
8
- import { BaseI18NContentContext as I18NContentContext } from "@webiny/api-i18n-content/types";
9
- import { TenancyContext } from "@webiny/api-tenancy/types";
10
- import { CmsContext } from "@webiny/api-headless-cms/types";
11
-
12
- // When working with the `context` object (for example while defining a new GraphQL resolver function),
13
- // you can import this interface and assign it to it. This will give you full autocomplete functionality
14
- // and type safety. The easiest way to import it would be via the following import statement:
15
- // import { Context } from "~/types";
16
- // Feel free to extend it with additional context interfaces, if needed. Also, please do not change the
17
- // name of the interface, as existing scaffolding utilities may rely on it during the scaffolding process.
18
- export interface Context
19
- extends HandlerContext,
20
- HttpContext,
21
- ArgsContext,
22
- ClientContext,
23
- TenancyContext,
24
- ElasticsearchContext,
25
- SecurityContext,
26
- I18NContext,
27
- I18NContentContext,
28
- CmsContext {}
@@ -1,49 +0,0 @@
1
- const targetVersion = "5.13.0";
2
-
3
- module.exports = {
4
- async canUpgrade(options, context) {
5
- if (context.version === targetVersion) {
6
- return true;
7
- } else if (
8
- context.version.match(
9
- new RegExp(
10
- /**
11
- * This is for beta testing.
12
- */
13
- `^${targetVersion}-`
14
- )
15
- )
16
- ) {
17
- return true;
18
- }
19
- throw new Error(
20
- `Upgrade must be on Webiny CLI version "${targetVersion}". Current CLI version is "${context.version}".`
21
- );
22
- },
23
-
24
- async upgrade(options, context) {
25
- const { createTypesTsFiles } = require("./createTypesTsFiles");
26
- const { addNewScaffolds } = require("./addNewScaffolds");
27
- const { addDotWebinyToGitIgnore } = require("./addDotWebinyToGitIgnore");
28
-
29
- await addDotWebinyToGitIgnore(context);
30
- await createTypesTsFiles(context);
31
- await addNewScaffolds(context);
32
-
33
- const { yarnInstall, prettierFormat } = require("../utils");
34
-
35
- await yarnInstall({ context });
36
-
37
- await prettierFormat(
38
- [
39
- "api/code/graphql/src/types.ts",
40
- "api/code/graphql/package.json",
41
- "api/code/headlessCMS/src/types.ts",
42
- "api/code/headlessCMS/package.json",
43
- "package.json",
44
- "webiny.project.ts"
45
- ],
46
- context
47
- );
48
- }
49
- };
@@ -1,97 +0,0 @@
1
- const path = require("path");
2
- const glob = require("fast-glob");
3
-
4
- const {
5
- createMorphProject,
6
- addPackagesToDependencies,
7
- yarnInstall,
8
- prettierFormat
9
- } = require("../utils");
10
-
11
- const apiPageBuilderUpgrade = require("./upgradeApiPageBuilder");
12
-
13
- const targetVersion = "5.15.0";
14
-
15
- /**
16
- * @type {CliUpgradePlugin}
17
- */
18
- module.exports = {
19
- name: `upgrade-${targetVersion}`,
20
- type: "cli-upgrade",
21
- version: targetVersion,
22
- /**
23
- * @param options {CliUpgradePluginOptions}
24
- * @param context {CliContext}
25
- * @returns {Promise<boolean>}
26
- */
27
- async canUpgrade(options, context) {
28
- if (context.version === targetVersion) {
29
- return true;
30
- } else if (
31
- context.version.match(
32
- new RegExp(
33
- /**
34
- * This is for beta testing.
35
- */
36
- `^${targetVersion}-`
37
- )
38
- )
39
- ) {
40
- return true;
41
- }
42
- throw new Error(
43
- `Upgrade must be on Webiny CLI version "${targetVersion}". Current CLI version is "${context.version}".`
44
- );
45
- },
46
-
47
- /**
48
- * @param options {CliUpgradePluginOptions}
49
- * @param context {CliContext}
50
- * @returns {Promise<void>}
51
- */
52
- async upgrade(options, context) {
53
- const { info } = context;
54
-
55
- const files = await glob([
56
- // add files here
57
- ...Object.values(apiPageBuilderUpgrade.files)
58
- //
59
- ]);
60
-
61
- const project = createMorphProject(files);
62
- /**
63
- * Upgrade the graphql with new page builder packages.
64
- */
65
- await apiPageBuilderUpgrade.upgradeGraphQLIndex(project, context);
66
- /**
67
- * Upgrade the page builder lambda with new packages.
68
- */
69
- await apiPageBuilderUpgrade.upgradePageBuilderIndex(project, context);
70
-
71
- info("Adding dependencies...");
72
-
73
- addPackagesToDependencies(context, path.resolve(process.cwd(), "api/code/graphql"), {
74
- "@webiny/api-page-builder-so-ddb-es": context.version
75
- });
76
-
77
- addPackagesToDependencies(
78
- context,
79
- path.resolve(process.cwd(), "api/code/pageBuilder/updateSettings"),
80
- {
81
- "@webiny/api-page-builder-so-ddb-es": context.version
82
- }
83
- );
84
-
85
- info("Writing changes...");
86
- await project.save();
87
-
88
- await prettierFormat(files, context);
89
-
90
- /**
91
- * Install new packages.
92
- */
93
- await yarnInstall({
94
- context
95
- });
96
- }
97
- };
@@ -1,121 +0,0 @@
1
- const { addImportsToSource } = require("../utils");
2
- const tsMorph = require("ts-morph");
3
- const FILES = {
4
- graphql: "api/code/graphql/src/index.ts",
5
- pageBuilder: "api/code/pageBuilder/updateSettings/src/index.ts"
6
- };
7
-
8
- const { Node, VariableDeclarationKind } = tsMorph;
9
-
10
- const pageBuilderDdbEsPlugins = "pageBuilderDynamoDbElasticsearchPlugins";
11
- const pageBuilderPrerenderingPlugins = "pageBuilderPrerenderingPlugins";
12
-
13
- const upgradeGraphQLIndex = async (project, context) => {
14
- const { info } = context;
15
- const file = FILES.graphql;
16
- info(`Upgrading ${info.hl(file)}`);
17
-
18
- const source = project.getSourceFile(file);
19
-
20
- addImportsToSource({
21
- context,
22
- source,
23
- imports: [
24
- {
25
- elementName: pageBuilderDdbEsPlugins,
26
- importPath: "@webiny/api-page-builder-so-ddb-es"
27
- },
28
- {
29
- elementName: pageBuilderPrerenderingPlugins,
30
- importPath: "@webiny/api-page-builder/prerendering"
31
- }
32
- ],
33
- file
34
- });
35
- };
36
-
37
- const upgradePageBuilderIndex = async (project, context) => {
38
- const { info, error } = context;
39
- const file = FILES.pageBuilder;
40
- info(`Upgrading ${info.hl(file)}`);
41
-
42
- const source = project.getSourceFile(file);
43
- /**
44
- * First we need to check for the existence of the debug flag
45
- */
46
- const debug = source.getFirstDescendant(
47
- node => Node.isPropertyAssignment(node) && node.getName() === "debug"
48
- );
49
- if (!debug) {
50
- /**
51
- * Find last import declaration.
52
- */
53
- const importDeclarations = source
54
- .getDescendants()
55
- .filter(node => Node.isImportDeclaration(node));
56
- if (importDeclarations.length > 0) {
57
- /**
58
- * We need to add the debug variable.
59
- */
60
- const lastDeclaration = importDeclarations[importDeclarations.length - 1];
61
- const index = lastDeclaration.getChildIndex();
62
- source.insertVariableStatement(index + 1, {
63
- kind: tsMorph.VariableDeclaration,
64
- declarationKind: VariableDeclarationKind.Const,
65
- declarations: [
66
- {
67
- name: "debug",
68
- initializer: `process.env.DEBUG === "true"`,
69
- kind: "const"
70
- }
71
- ]
72
- });
73
- } else {
74
- error(`Missing import declarations. Cannot insert the "debug" variable.`);
75
- }
76
- }
77
- /**
78
- * Also, we need to check if we have the plugins in the createHandler.
79
- */
80
- const plugins = source.getFirstDescendant(
81
- node => Node.isPropertyAssignment(node) && node.getName() === "plugins"
82
- );
83
- if (!plugins) {
84
- const createHandler = source.getFirstDescendant(
85
- node =>
86
- Node.isCallExpression(node) && node.getExpression().getText() === "createHandler"
87
- );
88
- /**
89
- * Get the arguments full text (function names + () )
90
- */
91
- const args = createHandler.getArguments().map(arg => {
92
- return arg.getText();
93
- });
94
- /**
95
- * Need to remove all existing arguments.
96
- */
97
- args.forEach(() => createHandler.removeArgument(0));
98
- /**
99
- * And in the end, add new argument that contains both plugins and http properties.
100
- */
101
- createHandler.addArgument(`{plugins: [${args.join(",")}], http: {debug}}`);
102
- }
103
-
104
- addImportsToSource({
105
- context,
106
- source,
107
- imports: [
108
- {
109
- elementName: pageBuilderDdbEsPlugins,
110
- importPath: "@webiny/api-page-builder-so-ddb-es"
111
- }
112
- ],
113
- file
114
- });
115
- };
116
-
117
- module.exports = {
118
- upgradeGraphQLIndex,
119
- upgradePageBuilderIndex,
120
- files: FILES
121
- };
@@ -1,207 +0,0 @@
1
- /**
2
- * A new type of upgrade where we take the files from cwp-template-aws and copy them into required locations.
3
- * Old files are always backed up.
4
- */
5
- const {
6
- prettierFormat,
7
- yarnUp,
8
- addWorkspaceToRootPackageJson,
9
- removeWorkspaceToRootPackageJson
10
- } = require("../utils");
11
- const { copyFolders, copyFiles } = require("../fileUtils");
12
- const path = require("path");
13
- const fs = require("fs");
14
- const cliPackageJson = require("@webiny/cli/package.json");
15
-
16
- const targetVersion = cliPackageJson.version;
17
-
18
- /**
19
- *
20
- * @param context {CliContext}
21
- * @param initialTargets {{source: string, destination: string}[]}
22
- */
23
- const assignPackageVersions = (context, initialTargets) => {
24
- const targets = initialTargets
25
- .filter(target => target.destination.match(/package\.json$/) !== null)
26
- .map(target => target.destination);
27
- if (targets.length === 0) {
28
- return;
29
- }
30
- context.info("Assigning proper package versions...");
31
- for (const target of targets) {
32
- const file = path.join(process.cwd(), target);
33
- try {
34
- const json = JSON.parse(fs.readFileSync(file).toString());
35
- /**
36
- *
37
- * @type {{}}
38
- */
39
- json.dependencies = Object.keys(json.dependencies).reduce((dependencies, key) => {
40
- if (key.match(/^@webiny\//) === null) {
41
- dependencies[key] = json.dependencies[key];
42
- return dependencies;
43
- } else if (json.dependencies[key] === "latest") {
44
- dependencies[key] = `${targetVersion}`;
45
- } else {
46
- dependencies[key] = json.dependencies[key];
47
- }
48
-
49
- return dependencies;
50
- }, {});
51
- /**
52
- *
53
- */
54
- if (json.devDependencies) {
55
- json.devDependencies = Object.keys(json.devDependencies).reduce(
56
- (dependencies, key) => {
57
- if (key.match(/^@webiny\//) === null) {
58
- dependencies[key] = json.devDependencies[key];
59
- return dependencies;
60
- } else if (json.devDependencies[key] === "latest") {
61
- dependencies[key] = `${targetVersion}`;
62
- } else {
63
- dependencies[key] = json.devDependencies[key];
64
- }
65
-
66
- return dependencies;
67
- },
68
- {}
69
- );
70
- }
71
- fs.writeFileSync(file, JSON.stringify(json));
72
- } catch (ex) {
73
- console.error(ex.message);
74
- }
75
- }
76
- };
77
-
78
- /**
79
- * @type {CliUpgradePlugin}
80
- */
81
- module.exports = {
82
- name: `upgrade-${targetVersion}`,
83
- type: "cli-upgrade",
84
- version: targetVersion,
85
- /**
86
- * @param options {CliUpgradePluginOptions}
87
- * @param context {CliContext}
88
- * @returns {Promise<boolean>}
89
- */
90
- async canUpgrade(options, context) {
91
- if (context.version === targetVersion) {
92
- return true;
93
- } else if (
94
- context.version.match(
95
- new RegExp(
96
- /**
97
- * This is for beta testing.
98
- */
99
- `^${targetVersion}-`
100
- )
101
- )
102
- ) {
103
- return true;
104
- }
105
- /**
106
- * We throw error here because it should not go further if version is not good.
107
- */
108
- throw new Error(
109
- `Upgrade must be on Webiny CLI version "${targetVersion}". Current CLI version is "${context.version}".`
110
- );
111
- },
112
- /**
113
- * @param options {CliUpgradePluginOptions}
114
- * @param context {CliContext}
115
- * @returns {Promise<void>}
116
- */
117
- async upgrade(options, context) {
118
- const targets = [
119
- {
120
- source: "node_modules/@webiny/cwp-template-aws/template/api/code/graphql/src/index.ts",
121
- destination: "api/code/graphql/src/index.ts"
122
- },
123
- {
124
- source: "node_modules/@webiny/cwp-template-aws/template/api/code/graphql/package.json",
125
- destination: "api/code/graphql/package.json"
126
- },
127
- // Update cloud resources for "dev" environment
128
- {
129
- source: "node_modules/@webiny/cwp-template-aws/template/api/pulumi/dev/index.ts",
130
- destination: "api/pulumi/dev/index.ts"
131
- },
132
- {
133
- source: "node_modules/@webiny/cwp-template-aws/template/api/pulumi/dev/policies.ts",
134
- destination: "api/pulumi/dev/policies.ts"
135
- },
136
- {
137
- source: "node_modules/@webiny/cwp-template-aws/template/api/pulumi/dev/pageBuilder.ts",
138
- destination: "api/pulumi/dev/pageBuilder.ts"
139
- },
140
- // Update cloud resources for "prod" environment
141
- {
142
- source: "node_modules/@webiny/cwp-template-aws/template/api/pulumi/prod/index.ts",
143
- destination: "api/pulumi/prod/index.ts"
144
- },
145
- {
146
- source: "node_modules/@webiny/cwp-template-aws/template/api/pulumi/prod/policies.ts",
147
- destination: "api/pulumi/prod/policies.ts"
148
- },
149
- {
150
- source: "node_modules/@webiny/cwp-template-aws/template/api/pulumi/prod/pageBuilder.ts",
151
- destination: "api/pulumi/prod/pageBuilder.ts"
152
- }
153
- ];
154
- /**
155
- * Copy new files to their destinations.
156
- */
157
- copyFiles(context, targets);
158
- /**
159
- * Copy folders to their destinations.
160
- */
161
- copyFolders(context, [
162
- {
163
- source: "node_modules/@webiny/cwp-template-aws/template/api/code/pageBuilder/exportPages",
164
- destination: "api/code/pageBuilder/exportPages"
165
- },
166
- {
167
- source: "node_modules/@webiny/cwp-template-aws/template/api/code/pageBuilder/importPages",
168
- destination: "api/code/pageBuilder/importPages"
169
- }
170
- ]);
171
- /**
172
- * If any package.json destinations, set the versions to current one.
173
- */
174
- assignPackageVersions(context, targets);
175
-
176
- /**
177
- * Update workspaces in root package.json.
178
- */
179
- context.info("Update workspaces in root package.json...");
180
- const rootPackageJson = path.join(context.project.root, "package.json");
181
- await addWorkspaceToRootPackageJson(rootPackageJson, [
182
- "api/code/pageBuilder/updateSettings",
183
- "api/code/pageBuilder/importPages/*",
184
- "api/code/pageBuilder/exportPages/*"
185
- ]);
186
- await removeWorkspaceToRootPackageJson(rootPackageJson, ["api/code/pageBuilder/*"]);
187
-
188
- await prettierFormat(
189
- targets.map(t => t.destination),
190
- context
191
- );
192
-
193
- /**
194
- * Up the versions again and install the packages.
195
- */
196
- await yarnUp({
197
- context,
198
- targetVersion
199
- });
200
-
201
- context.info("\n");
202
- context.info("Existing files were backed up and new ones created.");
203
- context.info(
204
- "You must transfer the custom parts of the code from the backed up files if you want everything to work properly."
205
- );
206
- }
207
- };