@webiny/cli 5.17.4 → 5.18.0-beta.3
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 +56 -0
- package/commands/upgrade/index.js +52 -11
- package/context.js +1 -2
- package/package.json +4 -15
- package/utils/getProjectApplication.js +25 -2
- package/utils/log.js +2 -2
- package/commands/upgrade/upgrades/5.10.0/index.js +0 -123
- package/commands/upgrade/upgrades/5.10.0/upgradeApiFileManager.js +0 -111
- package/commands/upgrade/upgrades/5.10.0/upgradeApolloCachePlugins.js +0 -114
- package/commands/upgrade/upgrades/5.10.0/upgradeDeliveryPath.js +0 -19
- package/commands/upgrade/upgrades/5.10.0/upgradeLambdaConfig.js +0 -30
- package/commands/upgrade/upgrades/5.11.0/index.js +0 -109
- package/commands/upgrade/upgrades/5.11.0/upgradeApiI18n.js +0 -59
- package/commands/upgrade/upgrades/5.11.0/upgradeObjectField.js +0 -59
- package/commands/upgrade/upgrades/5.11.0/upgradeWebsite.js +0 -21
- package/commands/upgrade/upgrades/5.12.0/index.js +0 -106
- package/commands/upgrade/upgrades/5.12.0/upgradeApiSecurity.js +0 -53
- package/commands/upgrade/upgrades/5.12.0/upgradeElasticsearch.js +0 -111
- package/commands/upgrade/upgrades/5.13.0/addDotWebinyToGitIgnore.js +0 -25
- package/commands/upgrade/upgrades/5.13.0/addNewScaffolds.js +0 -75
- package/commands/upgrade/upgrades/5.13.0/createTypesTsFiles.js +0 -101
- package/commands/upgrade/upgrades/5.13.0/files/types/graphql.ts +0 -34
- package/commands/upgrade/upgrades/5.13.0/files/types/headlessCMS.ts +0 -28
- package/commands/upgrade/upgrades/5.13.0/index.js +0 -49
- package/commands/upgrade/upgrades/5.15.0/index.js +0 -97
- package/commands/upgrade/upgrades/5.15.0/upgradeApiPageBuilder.js +0 -121
- package/commands/upgrade/upgrades/5.16.0/index.js +0 -207
- package/commands/upgrade/upgrades/5.17.0/apiPrerenderingService.js +0 -182
- package/commands/upgrade/upgrades/5.17.0/index.js +0 -93
- package/commands/upgrade/upgrades/5.17.0/security.js +0 -611
- package/commands/upgrade/upgrades/5.5.0/index.js +0 -426
- package/commands/upgrade/upgrades/5.5.0/templates/api/default.webiny.config.js +0 -8
- package/commands/upgrade/upgrades/5.5.0/templates/api/fileManagerTransform.webiny.config.js +0 -9
- package/commands/upgrade/upgrades/5.5.0/templates/api/prerenderingService.webiny.config.js +0 -30
- package/commands/upgrade/upgrades/5.5.0/templates/customPackages/webiny.config.js +0 -8
- package/commands/upgrade/upgrades/5.5.0/templates/webinyApplication/api/webiny.application.js +0 -9
- package/commands/upgrade/upgrades/5.5.0/templates/webinyApplication/apps/admin/webiny.application.js +0 -15
- package/commands/upgrade/upgrades/5.5.0/templates/webinyApplication/apps/site/webiny.application.js +0 -16
- package/commands/upgrade/upgrades/5.5.0/templates/webinyApplication/apps/website/webiny.application.js +0 -16
- package/commands/upgrade/upgrades/5.8.0/index.js +0 -137
- package/commands/upgrade/upgrades/5.9.0/index.js +0 -144
- package/commands/upgrade/upgrades/5.9.0/upgradeScaffolding/babelrc.js +0 -1
- package/commands/upgrade/upgrades/5.9.0/upgradeScaffolding/jestConfig.js +0 -40
- package/commands/upgrade/upgrades/5.9.0/upgradeScaffolding.js +0 -337
- package/commands/upgrade/upgrades/5.9.0/upgradeSecurity.js +0 -280
- package/commands/upgrade/upgrades/5.9.0/upgradeTelemetry.js +0 -30
- package/commands/upgrade/upgrades/fileUtils.js +0 -152
- package/commands/upgrade/upgrades/upgrade.js +0 -1
- package/commands/upgrade/upgrades/utils.js +0 -792
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line
|
|
2
|
-
const tsMorph = require("ts-morph");
|
|
3
|
-
|
|
4
|
-
const {
|
|
5
|
-
insertImportToSourceFile,
|
|
6
|
-
addPackagesToDependencies,
|
|
7
|
-
removeImportFromSourceFile,
|
|
8
|
-
upgradeCreateHandlerToPlugins,
|
|
9
|
-
removePluginFromCreateHandler,
|
|
10
|
-
addPluginArgumentValueInCreateHandler,
|
|
11
|
-
addDynamoDbDocumentClient
|
|
12
|
-
} = require("../utils");
|
|
13
|
-
const path = require("path");
|
|
14
|
-
|
|
15
|
-
const paths = {
|
|
16
|
-
flush: "api/code/prerenderingService/flush",
|
|
17
|
-
queueAdd: "api/code/prerenderingService/queue/add",
|
|
18
|
-
queueProcess: "api/code/prerenderingService/queue/process",
|
|
19
|
-
render: "api/code/prerenderingService/render"
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const files = {
|
|
23
|
-
flush: `${paths.flush}/src/index.ts`,
|
|
24
|
-
queueAdd: `${paths.queueAdd}/src/index.ts`,
|
|
25
|
-
queueProcess: `${paths.queueProcess}/src/index.ts`,
|
|
26
|
-
render: `${paths.render}/src/index.ts`
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @param project {tsMorph.Project}
|
|
31
|
-
* @param context {CliContext}
|
|
32
|
-
*/
|
|
33
|
-
const upgradeFlush = (project, context) => {
|
|
34
|
-
const { info } = context;
|
|
35
|
-
info(`Upgrading ${info.hl(files.flush)}`);
|
|
36
|
-
|
|
37
|
-
const source = project.getSourceFile(files.flush);
|
|
38
|
-
|
|
39
|
-
addPackagesToDependencies(context, path.resolve(process.cwd(), paths.flush), {
|
|
40
|
-
"@webiny/api-prerendering-service-so-ddb": context.version,
|
|
41
|
-
"@webiny/db-dynamodb": null,
|
|
42
|
-
"@webiny/handler-db": null
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
addDynamoDbDocumentClient(source);
|
|
46
|
-
|
|
47
|
-
removeImportFromSourceFile(source, "@webiny/db-dynamodb");
|
|
48
|
-
removeImportFromSourceFile(source, "@webiny/handler-db");
|
|
49
|
-
|
|
50
|
-
insertImportToSourceFile({
|
|
51
|
-
source,
|
|
52
|
-
name: ["createPrerenderingServiceStorageOperations"],
|
|
53
|
-
moduleSpecifier: "@webiny/api-prerendering-service-so-ddb"
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
upgradeCreateHandlerToPlugins(source, "handler");
|
|
57
|
-
|
|
58
|
-
removePluginFromCreateHandler(source, "handler", new RegExp(/^dbPlugins\(\{/));
|
|
59
|
-
|
|
60
|
-
addPluginArgumentValueInCreateHandler(source, "handler", "flushPlugins", {
|
|
61
|
-
storageOperations:
|
|
62
|
-
"createPrerenderingServiceStorageOperations({documentClient, table: table => ({ ...table, name: process.env.DB_TABLE })})"
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* @param project {tsMorph.Project}
|
|
67
|
-
* @param context {CliContext}
|
|
68
|
-
*/
|
|
69
|
-
const upgradeQueueAdd = (project, context) => {
|
|
70
|
-
const { info } = context;
|
|
71
|
-
info(`Upgrading ${info.hl(files.queueAdd)}`);
|
|
72
|
-
|
|
73
|
-
const source = project.getSourceFile(files.queueAdd);
|
|
74
|
-
|
|
75
|
-
addPackagesToDependencies(context, path.resolve(process.cwd(), paths.queueAdd), {
|
|
76
|
-
"@webiny/api-prerendering-service-so-ddb": context.version,
|
|
77
|
-
"@webiny/db-dynamodb": null,
|
|
78
|
-
"@webiny/handler-db": null
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
addDynamoDbDocumentClient(source);
|
|
82
|
-
|
|
83
|
-
removeImportFromSourceFile(source, "@webiny/db-dynamodb");
|
|
84
|
-
removeImportFromSourceFile(source, "@webiny/handler-db");
|
|
85
|
-
|
|
86
|
-
insertImportToSourceFile({
|
|
87
|
-
source,
|
|
88
|
-
name: ["createPrerenderingServiceStorageOperations"],
|
|
89
|
-
moduleSpecifier: "@webiny/api-prerendering-service-so-ddb"
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
upgradeCreateHandlerToPlugins(source, "handler");
|
|
93
|
-
|
|
94
|
-
removePluginFromCreateHandler(source, "handler", new RegExp(/^dbPlugins\(\{/));
|
|
95
|
-
|
|
96
|
-
addPluginArgumentValueInCreateHandler(source, "handler", "queueAddPlugins", {
|
|
97
|
-
storageOperations:
|
|
98
|
-
"createPrerenderingServiceStorageOperations({documentClient, table: table => ({ ...table, name: process.env.DB_TABLE })})"
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* @param project {tsMorph.Project}
|
|
104
|
-
* @param context {CliContext}
|
|
105
|
-
*/
|
|
106
|
-
const upgradeQueueProcess = (project, context) => {
|
|
107
|
-
const { info } = context;
|
|
108
|
-
info(`Upgrading ${info.hl(files.queueProcess)}`);
|
|
109
|
-
|
|
110
|
-
const source = project.getSourceFile(files.queueProcess);
|
|
111
|
-
|
|
112
|
-
addPackagesToDependencies(context, path.resolve(process.cwd(), paths.queueProcess), {
|
|
113
|
-
"@webiny/api-prerendering-service-so-ddb": context.version,
|
|
114
|
-
"@webiny/db-dynamodb": null,
|
|
115
|
-
"@webiny/handler-db": null
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
addDynamoDbDocumentClient(source);
|
|
119
|
-
|
|
120
|
-
removeImportFromSourceFile(source, "@webiny/db-dynamodb");
|
|
121
|
-
removeImportFromSourceFile(source, "@webiny/handler-db");
|
|
122
|
-
|
|
123
|
-
insertImportToSourceFile({
|
|
124
|
-
source,
|
|
125
|
-
name: ["createPrerenderingServiceStorageOperations"],
|
|
126
|
-
moduleSpecifier: "@webiny/api-prerendering-service-so-ddb"
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
upgradeCreateHandlerToPlugins(source, "handler");
|
|
130
|
-
|
|
131
|
-
removePluginFromCreateHandler(source, "handler", new RegExp(/^dbPlugins\(\{/));
|
|
132
|
-
|
|
133
|
-
addPluginArgumentValueInCreateHandler(source, "handler", "queueProcessPlugins", {
|
|
134
|
-
storageOperations:
|
|
135
|
-
"createPrerenderingServiceStorageOperations({documentClient, table: table => ({ ...table, name: process.env.DB_TABLE })})"
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* @param project {tsMorph.Project}
|
|
141
|
-
* @param context {CliContext}
|
|
142
|
-
*/
|
|
143
|
-
const upgradeRender = (project, context) => {
|
|
144
|
-
const { info } = context;
|
|
145
|
-
info(`Upgrading ${info.hl(files.render)}`);
|
|
146
|
-
|
|
147
|
-
const source = project.getSourceFile(files.render);
|
|
148
|
-
|
|
149
|
-
addPackagesToDependencies(context, path.resolve(process.cwd(), paths.render), {
|
|
150
|
-
"@webiny/api-prerendering-service-so-ddb": context.version,
|
|
151
|
-
"@webiny/db-dynamodb": null,
|
|
152
|
-
"@webiny/handler-db": null
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
addDynamoDbDocumentClient(source);
|
|
156
|
-
|
|
157
|
-
removeImportFromSourceFile(source, "@webiny/db-dynamodb");
|
|
158
|
-
removeImportFromSourceFile(source, "@webiny/handler-db");
|
|
159
|
-
|
|
160
|
-
insertImportToSourceFile({
|
|
161
|
-
source,
|
|
162
|
-
name: ["createPrerenderingServiceStorageOperations"],
|
|
163
|
-
moduleSpecifier: "@webiny/api-prerendering-service-so-ddb"
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
upgradeCreateHandlerToPlugins(source, "handler");
|
|
167
|
-
|
|
168
|
-
removePluginFromCreateHandler(source, "handler", new RegExp(/^dbPlugins\(\{/));
|
|
169
|
-
|
|
170
|
-
addPluginArgumentValueInCreateHandler(source, "handler", "renderPlugins", {
|
|
171
|
-
storageOperations:
|
|
172
|
-
"createPrerenderingServiceStorageOperations({documentClient, table: table => ({ ...table, name: process.env.DB_TABLE })})"
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
module.exports = {
|
|
177
|
-
files,
|
|
178
|
-
upgradeFlush,
|
|
179
|
-
upgradeQueueAdd,
|
|
180
|
-
upgradeQueueProcess,
|
|
181
|
-
upgradeRender
|
|
182
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
const glob = require("fast-glob");
|
|
2
|
-
|
|
3
|
-
const { createMorphProject, yarnInstall, prettierFormat } = require("../utils");
|
|
4
|
-
|
|
5
|
-
const apiPrerenderingService = require("./apiPrerenderingService");
|
|
6
|
-
const security = require("./security");
|
|
7
|
-
|
|
8
|
-
const targetVersion = "5.17.0";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @type {CliUpgradePlugin}
|
|
12
|
-
*/
|
|
13
|
-
module.exports = {
|
|
14
|
-
name: `upgrade-${targetVersion}`,
|
|
15
|
-
type: "cli-upgrade",
|
|
16
|
-
version: targetVersion,
|
|
17
|
-
/**
|
|
18
|
-
* @param options {CliUpgradePluginOptions}
|
|
19
|
-
* @param context {CliContext}
|
|
20
|
-
* @returns {Promise<boolean>}
|
|
21
|
-
*/
|
|
22
|
-
async canUpgrade(options, context) {
|
|
23
|
-
if (context.version === targetVersion) {
|
|
24
|
-
return true;
|
|
25
|
-
} else if (
|
|
26
|
-
context.version.match(
|
|
27
|
-
new RegExp(
|
|
28
|
-
/**
|
|
29
|
-
* This is for beta testing.
|
|
30
|
-
*/
|
|
31
|
-
`^${targetVersion}-`
|
|
32
|
-
)
|
|
33
|
-
)
|
|
34
|
-
) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
throw new Error(
|
|
38
|
-
`Upgrade must be on Webiny CLI version "${targetVersion}". Current CLI version is "${context.version}".`
|
|
39
|
-
);
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @param options {CliUpgradePluginOptions}
|
|
44
|
-
* @param context {CliContext}
|
|
45
|
-
* @returns {Promise<void>}
|
|
46
|
-
*/
|
|
47
|
-
async upgrade(options, context) {
|
|
48
|
-
const { info } = context;
|
|
49
|
-
|
|
50
|
-
const files = await glob([
|
|
51
|
-
// add files here
|
|
52
|
-
...Object.values(apiPrerenderingService.files),
|
|
53
|
-
...Object.values(security.files)
|
|
54
|
-
//
|
|
55
|
-
]);
|
|
56
|
-
|
|
57
|
-
const project = createMorphProject(files);
|
|
58
|
-
/**
|
|
59
|
-
* Upgrade the prerendering service files.
|
|
60
|
-
*/
|
|
61
|
-
info("Starting with prerendering service upgrade.");
|
|
62
|
-
apiPrerenderingService.upgradeFlush(project, context);
|
|
63
|
-
apiPrerenderingService.upgradeRender(project, context);
|
|
64
|
-
apiPrerenderingService.upgradeQueueAdd(project, context);
|
|
65
|
-
apiPrerenderingService.upgradeQueueProcess(project, context);
|
|
66
|
-
/**
|
|
67
|
-
* Upgrade the files for new security.
|
|
68
|
-
*/
|
|
69
|
-
info("Starting with security upgrade.");
|
|
70
|
-
security.upgradeGraphQLIndex(project, context);
|
|
71
|
-
security.upgradePageImportExport(project, context);
|
|
72
|
-
security.upgradeHeadlessCMSIndex(project, context);
|
|
73
|
-
security.upgradeAdminComponents(project, context);
|
|
74
|
-
security.upgradeAdminPlugins(project, context);
|
|
75
|
-
security.upgradeAdminSecurity(project, context);
|
|
76
|
-
security.upgradeApp(project, context);
|
|
77
|
-
security.upgradeAppWebinyConfig(project, context);
|
|
78
|
-
security.upgradePulumiDev(project, context);
|
|
79
|
-
security.upgradePulumiProd(project, context);
|
|
80
|
-
|
|
81
|
-
info("Writing changes...");
|
|
82
|
-
await project.save();
|
|
83
|
-
|
|
84
|
-
await prettierFormat(files, context);
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Install new packages.
|
|
88
|
-
*/
|
|
89
|
-
await yarnInstall({
|
|
90
|
-
context
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
};
|