@modern-js/upgrade-generator 3.7.1 → 3.7.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/dist/index.js +12 -197
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -168,196 +168,12 @@
|
|
|
168
168
|
// src/index.ts
|
|
169
169
|
var import_codesmith_api_app = __toESM(require_codesmith_api_app());
|
|
170
170
|
var import_codesmith_api_json = __toESM(require_codesmith_api_json());
|
|
171
|
-
// ../../generator-common/dist/esm-node/locale/index.js
|
|
172
|
-
var import_plugin_i18n = __toESM(require_plugin_i18n());
|
|
173
|
-
// ../../generator-common/dist/esm-node/locale/en.js
|
|
174
|
-
var EN_LOCALE = {
|
|
175
|
-
solution: {
|
|
176
|
-
self: "Please select the type of project you want to create:",
|
|
177
|
-
mwa: "Web App",
|
|
178
|
-
module: "Npm Module",
|
|
179
|
-
custom: "Custom Solution",
|
|
180
|
-
default: "Default"
|
|
181
|
-
},
|
|
182
|
-
scenes: {
|
|
183
|
-
self: "Please select the project scenario:"
|
|
184
|
-
},
|
|
185
|
-
sub_solution: {
|
|
186
|
-
self: "Please select the type of project you want to create:",
|
|
187
|
-
mwa: "Web App",
|
|
188
|
-
module: "Npm Module"
|
|
189
|
-
},
|
|
190
|
-
action: {
|
|
191
|
-
self: "Please select the operation you want:",
|
|
192
|
-
function: {
|
|
193
|
-
self: "Enable Features",
|
|
194
|
-
question: "Please select the feature name:",
|
|
195
|
-
tailwindcss: "Enable Tailwind CSS",
|
|
196
|
-
bff: "Enable BFF",
|
|
197
|
-
micro_frontend: "Enable Micro Frontend",
|
|
198
|
-
i18n: "Enable Internationalization (i18n)",
|
|
199
|
-
storybookV7: "Enable Storybook V7",
|
|
200
|
-
runtime_api: "Enable Runtime API",
|
|
201
|
-
ssg: "Enable SSG",
|
|
202
|
-
polyfill: "Enable UA-based Polyfill Feature",
|
|
203
|
-
proxy: "Enable Global Proxy",
|
|
204
|
-
swc: "Enable SWC Compile",
|
|
205
|
-
module_doc: "Enable Module Doc"
|
|
206
|
-
},
|
|
207
|
-
element: {
|
|
208
|
-
self: "Create Element",
|
|
209
|
-
question: "Please select the type of element to create:",
|
|
210
|
-
entry: 'New "entry"',
|
|
211
|
-
server: 'New "Custom Web Server" source code directory'
|
|
212
|
-
},
|
|
213
|
-
refactor: {
|
|
214
|
-
self: "Automatic Refactor",
|
|
215
|
-
question: "Please select the type of refactoring:",
|
|
216
|
-
react_router_5: "Use React Router v5"
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
boolean: {
|
|
220
|
-
yes: "Yes",
|
|
221
|
-
no: "No"
|
|
222
|
-
},
|
|
223
|
-
language: {
|
|
224
|
-
self: "Please select the programming language:"
|
|
225
|
-
},
|
|
226
|
-
packageManager: {
|
|
227
|
-
self: "Please select the package manager:"
|
|
228
|
-
},
|
|
229
|
-
entry: {
|
|
230
|
-
name: "Please fill in the entry name:",
|
|
231
|
-
no_empty: "The entry name cannot be empty!",
|
|
232
|
-
no_pages: 'The entry name cannot be "pages"!'
|
|
233
|
-
},
|
|
234
|
-
packageName: {
|
|
235
|
-
self: "Please fill in the project name:",
|
|
236
|
-
sub_name: "Please fill in the sub-project name:",
|
|
237
|
-
no_empty: "The package name cannot be empty!"
|
|
238
|
-
},
|
|
239
|
-
packagePath: {
|
|
240
|
-
self: "Please fill in the sub-project directory name:",
|
|
241
|
-
no_empty: "The package path cannot be empty!",
|
|
242
|
-
format: "Only lowercase letters, numbers and delimiters (-), and underscore (_), and directory delimiters (/) can be used in package path."
|
|
243
|
-
},
|
|
244
|
-
framework: {
|
|
245
|
-
self: "Please select the framework:",
|
|
246
|
-
egg: "Egg",
|
|
247
|
-
express: "Express",
|
|
248
|
-
koa: "Koa",
|
|
249
|
-
nest: "Nest"
|
|
250
|
-
},
|
|
251
|
-
bff: {
|
|
252
|
-
bffType: {
|
|
253
|
-
self: "Please select the BFF type:",
|
|
254
|
-
func: "Function",
|
|
255
|
-
framework: "Framework"
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
// ../../generator-common/dist/esm-node/locale/zh.js
|
|
260
|
-
var ZH_LOCALE = {
|
|
261
|
-
solution: {
|
|
262
|
-
self: "请选择你想创建的工程类型",
|
|
263
|
-
mwa: "Web 应用",
|
|
264
|
-
module: "Npm 模块",
|
|
265
|
-
custom: "自定义",
|
|
266
|
-
default: "默认"
|
|
267
|
-
},
|
|
268
|
-
scenes: {
|
|
269
|
-
self: "请选择项目场景"
|
|
270
|
-
},
|
|
271
|
-
sub_solution: {
|
|
272
|
-
self: "请选择你想创建的工程类型",
|
|
273
|
-
mwa: "Web 应用",
|
|
274
|
-
module: "Npm 模块"
|
|
275
|
-
},
|
|
276
|
-
action: {
|
|
277
|
-
self: "请选择你想要的操作",
|
|
278
|
-
function: {
|
|
279
|
-
self: "启用可选功能",
|
|
280
|
-
question: "请选择功能名称",
|
|
281
|
-
tailwindcss: "启用「Tailwind CSS」 支持",
|
|
282
|
-
bff: "启用「BFF」功能",
|
|
283
|
-
micro_frontend: "启用「微前端」模式",
|
|
284
|
-
i18n: "启用「国际化(i18n)」功能",
|
|
285
|
-
storybookV7: "启用「Storybook」V7",
|
|
286
|
-
runtime_api: "启用「Runtime API」",
|
|
287
|
-
ssg: "启用「SSG」功能",
|
|
288
|
-
polyfill: "启用「基于 UA 的 Polyfill」功能",
|
|
289
|
-
proxy: "启用「全局代理」",
|
|
290
|
-
swc: "启用「SWC 编译」",
|
|
291
|
-
module_doc: "启动「模块文档」功能"
|
|
292
|
-
},
|
|
293
|
-
element: {
|
|
294
|
-
self: "创建工程元素",
|
|
295
|
-
question: "请选择创建元素类型",
|
|
296
|
-
entry: "新建「应用入口」",
|
|
297
|
-
server: "新建「自定义 Web Server」源码目录"
|
|
298
|
-
},
|
|
299
|
-
refactor: {
|
|
300
|
-
self: "自动重构",
|
|
301
|
-
question: "请选择重构类型",
|
|
302
|
-
react_router_5: "使用 React Router v5"
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
boolean: {
|
|
306
|
-
yes: "是",
|
|
307
|
-
no: "否"
|
|
308
|
-
},
|
|
309
|
-
language: {
|
|
310
|
-
self: "请选择开发语言"
|
|
311
|
-
},
|
|
312
|
-
packageManager: {
|
|
313
|
-
self: "请选择包管理工具"
|
|
314
|
-
},
|
|
315
|
-
entry: {
|
|
316
|
-
name: "请填写入口名称",
|
|
317
|
-
no_empty: "入口名称不能为空!",
|
|
318
|
-
no_pages: '入口名称不支持 "pages"!'
|
|
319
|
-
},
|
|
320
|
-
packageName: {
|
|
321
|
-
self: "请填写项目名称",
|
|
322
|
-
sub_name: "请填写子项目名称",
|
|
323
|
-
no_empty: "项目名称不能为空!"
|
|
324
|
-
},
|
|
325
|
-
packagePath: {
|
|
326
|
-
self: "请填写子项目目录名称",
|
|
327
|
-
no_empty: "目录名称不能为空!",
|
|
328
|
-
format: "目录名称只能使用小写字母、数字和分隔线(-)、下划线(_)和目录分隔符(/)"
|
|
329
|
-
},
|
|
330
|
-
framework: {
|
|
331
|
-
self: "请选择运行时框架",
|
|
332
|
-
egg: "Egg",
|
|
333
|
-
express: "Express",
|
|
334
|
-
koa: "Koa",
|
|
335
|
-
nest: "Nest"
|
|
336
|
-
},
|
|
337
|
-
bff: {
|
|
338
|
-
bffType: {
|
|
339
|
-
self: "请选择 BFF 类型",
|
|
340
|
-
func: "函数模式",
|
|
341
|
-
framework: "框架模式"
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
// ../../generator-common/dist/esm-node/locale/index.js
|
|
346
|
-
var i18n = new import_plugin_i18n.I18n();
|
|
347
|
-
var localeKeys = i18n.init("en", {
|
|
348
|
-
zh: ZH_LOCALE,
|
|
349
|
-
en: EN_LOCALE
|
|
350
|
-
});
|
|
351
171
|
// ../../generator-common/dist/esm-node/common/solution.js
|
|
352
172
|
var Solution;
|
|
353
173
|
(function(Solution2) {
|
|
354
174
|
Solution2["MWA"] = "mwa";
|
|
355
175
|
Solution2["Module"] = "module";
|
|
356
176
|
})(Solution || (Solution = {}));
|
|
357
|
-
var SolutionText = {
|
|
358
|
-
["mwa"]: ()=>i18n.t(localeKeys.solution.mwa),
|
|
359
|
-
["module"]: ()=>i18n.t(localeKeys.solution.module)
|
|
360
|
-
};
|
|
361
177
|
var SolutionToolsMap = {
|
|
362
178
|
["mwa"]: "@modern-js/app-tools",
|
|
363
179
|
["module"]: "@modern-js/module-tools"
|
|
@@ -535,9 +351,9 @@
|
|
|
535
351
|
});
|
|
536
352
|
}
|
|
537
353
|
// src/locale/index.ts
|
|
538
|
-
var
|
|
354
|
+
var import_plugin_i18n = __toESM(require_plugin_i18n());
|
|
539
355
|
// src/locale/en.ts
|
|
540
|
-
var
|
|
356
|
+
var EN_LOCALE = {
|
|
541
357
|
projectType: "Project Type",
|
|
542
358
|
modernVersion: "Modern.js Latest Version",
|
|
543
359
|
alreadyLatest: `The current version of Modern.js is the latest`,
|
|
@@ -548,7 +364,7 @@
|
|
|
548
364
|
success: "Upgrade Modern.js package version success!"
|
|
549
365
|
};
|
|
550
366
|
// src/locale/zh.ts
|
|
551
|
-
var
|
|
367
|
+
var ZH_LOCALE = {
|
|
552
368
|
projectType: "项目类型",
|
|
553
369
|
modernVersion: "Modern.js 最新版本",
|
|
554
370
|
alreadyLatest: "当前项目 Modern.js 依赖已经为最新版本",
|
|
@@ -562,10 +378,10 @@
|
|
|
562
378
|
success: "已更新 Modern.js 依赖至最新版本"
|
|
563
379
|
};
|
|
564
380
|
// src/locale/index.ts
|
|
565
|
-
var
|
|
566
|
-
var
|
|
567
|
-
zh:
|
|
568
|
-
en:
|
|
381
|
+
var i18n = new import_plugin_i18n.I18n();
|
|
382
|
+
var localeKeys = i18n.init("en", {
|
|
383
|
+
zh: ZH_LOCALE,
|
|
384
|
+
en: EN_LOCALE
|
|
569
385
|
});
|
|
570
386
|
// src/index.ts
|
|
571
387
|
var SpecialModernDeps = [
|
|
@@ -595,16 +411,15 @@
|
|
|
595
411
|
const deps = __spreadValues(__spreadValues({}, pkgInfo.devDependencies), pkgInfo.dependencies);
|
|
596
412
|
const solutions = Object.keys(SolutionToolsMap).filter((solution)=>deps[SolutionToolsMap[solution]]);
|
|
597
413
|
if (solutions.length === 0) {
|
|
598
|
-
throw Error(
|
|
414
|
+
throw Error(i18n.t(localeKeys.tooltip.no_solution));
|
|
599
415
|
}
|
|
600
416
|
if (solutions.length >= 2) {
|
|
601
|
-
throw Error(
|
|
417
|
+
throw Error(i18n.t(localeKeys.tooltip.more_solution));
|
|
602
418
|
}
|
|
603
|
-
generator.logger.info(`[${i18n2.t(localeKeys2.projectType)}]: ${SolutionText[solutions[0]]()}`);
|
|
604
419
|
const modernVersion = yield getModernVersion(solutions[0], context.config.registry, context.config.distTag || "latest");
|
|
605
|
-
generator.logger.info(`[${
|
|
420
|
+
generator.logger.info(`[${i18n.t(localeKeys.modernVersion)}]: ${modernVersion}`);
|
|
606
421
|
if (Object.keys(deps).filter((dep)=>dep.startsWith("@modern-js") || dep.startsWith("@modern-js-app")).filter((dep)=>!dep.includes("electron")).filter((dep)=>!dep.includes("codesmith") && !dep.includes("easy-form")).filter((dep)=>!dep.startsWith("@modern-js-reduck")).filter((dep)=>!dep.includes("eslint-config")).every((dep)=>deps[dep] === modernVersion)) {
|
|
607
|
-
generator.logger.info(`[${
|
|
422
|
+
generator.logger.info(`[${i18n.t(localeKeys.alreadyLatest)}]: ${modernVersion}`);
|
|
608
423
|
return;
|
|
609
424
|
}
|
|
610
425
|
const appDir = context.materials.default.basePath;
|
|
@@ -655,7 +470,7 @@
|
|
|
655
470
|
}, true);
|
|
656
471
|
spinner.stop();
|
|
657
472
|
yield appApi.runInstall();
|
|
658
|
-
appApi.showSuccessInfo(
|
|
473
|
+
appApi.showSuccessInfo(i18n.t(localeKeys.success));
|
|
659
474
|
});
|
|
660
475
|
var src_default = (context, generator)=>__async(void 0, null, function*() {
|
|
661
476
|
const appApi = new import_codesmith_api_app.AppAPI(context, generator);
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.7.
|
|
18
|
+
"version": "3.7.3",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"main": "./dist/index.js",
|
|
21
21
|
"files": [
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"@types/node": "^14",
|
|
32
32
|
"jest": "^29",
|
|
33
33
|
"typescript": "^5",
|
|
34
|
-
"@modern-js/generator-common": "3.7.
|
|
35
|
-
"@modern-js/generator-utils": "3.7.
|
|
36
|
-
"@modern-js/plugin-i18n": "2.
|
|
37
|
-
"@scripts/build": "2.
|
|
38
|
-
"@scripts/jest-config": "2.
|
|
34
|
+
"@modern-js/generator-common": "3.7.3",
|
|
35
|
+
"@modern-js/generator-utils": "3.7.3",
|
|
36
|
+
"@modern-js/plugin-i18n": "2.61.0",
|
|
37
|
+
"@scripts/build": "2.61.0",
|
|
38
|
+
"@scripts/jest-config": "2.61.0"
|
|
39
39
|
},
|
|
40
40
|
"sideEffects": false,
|
|
41
41
|
"publishConfig": {
|