@modern-js/upgrade 2.25.2 → 2.26.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +42 -23
- package/package.json +6 -6
package/dist/index.js
CHANGED
@@ -2,6 +2,9 @@ var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __esm = (fn, res) => function __init() {
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
7
|
+
};
|
5
8
|
var __export = (target, all) => {
|
6
9
|
for (var name in all)
|
7
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
@@ -36,23 +39,20 @@ var __async = (__this, __arguments, generator) => {
|
|
36
39
|
});
|
37
40
|
};
|
38
41
|
|
39
|
-
// src/
|
40
|
-
var
|
41
|
-
__export(
|
42
|
-
default: () => src_default,
|
43
|
-
defineCommand: () => defineCommand,
|
42
|
+
// src/upgrade.ts
|
43
|
+
var upgrade_exports = {};
|
44
|
+
__export(upgrade_exports, {
|
44
45
|
upgradeAction: () => upgradeAction
|
45
46
|
});
|
46
|
-
module.exports = __toCommonJS(src_exports);
|
47
|
-
var import_utils = require("@modern-js/utils");
|
48
|
-
var import_language_detector = require("@modern-js/plugin-i18n/language-detector");
|
49
|
-
|
50
|
-
// src/upgrade.ts
|
51
|
-
var import_codesmith = require("@modern-js/codesmith");
|
52
|
-
var UPGRADE_GENERATOR = "@modern-js/upgrade-generator";
|
53
47
|
function upgradeAction(options) {
|
54
48
|
return __async(this, null, function* () {
|
55
|
-
const {
|
49
|
+
const {
|
50
|
+
cwd = process.cwd(),
|
51
|
+
debug = false,
|
52
|
+
distTag,
|
53
|
+
registry,
|
54
|
+
needInstall
|
55
|
+
} = options;
|
56
56
|
const projectDir = cwd;
|
57
57
|
const smith = new import_codesmith.CodeSmith({
|
58
58
|
debug
|
@@ -69,7 +69,12 @@ function upgradeAction(options) {
|
|
69
69
|
tasks: [
|
70
70
|
{
|
71
71
|
generator,
|
72
|
-
config: {
|
72
|
+
config: {
|
73
|
+
debug,
|
74
|
+
distTag,
|
75
|
+
registry,
|
76
|
+
noNeedInstall: !needInstall
|
77
|
+
}
|
73
78
|
}
|
74
79
|
],
|
75
80
|
pwd: cwd
|
@@ -79,6 +84,21 @@ function upgradeAction(options) {
|
|
79
84
|
}
|
80
85
|
});
|
81
86
|
}
|
87
|
+
var import_codesmith, UPGRADE_GENERATOR;
|
88
|
+
var init_upgrade = __esm({
|
89
|
+
"src/upgrade.ts"() {
|
90
|
+
import_codesmith = require("@modern-js/codesmith");
|
91
|
+
UPGRADE_GENERATOR = "@modern-js/upgrade-generator";
|
92
|
+
}
|
93
|
+
});
|
94
|
+
|
95
|
+
// src/index.ts
|
96
|
+
var src_exports = {};
|
97
|
+
__export(src_exports, {
|
98
|
+
defineCommand: () => defineCommand
|
99
|
+
});
|
100
|
+
module.exports = __toCommonJS(src_exports);
|
101
|
+
var import_language_detector = require("@modern-js/plugin-i18n/language-detector");
|
82
102
|
|
83
103
|
// src/locale/index.ts
|
84
104
|
var import_plugin_i18n = require("@modern-js/plugin-i18n");
|
@@ -90,6 +110,7 @@ var ZH_LOCALE = {
|
|
90
110
|
distTag: "升级时底层生成器使用特殊的 npm Tag",
|
91
111
|
registry: "定制 npm registry",
|
92
112
|
debug: "开启 Debug 模式,打印调试日志信息",
|
113
|
+
noNeedInstall: "无需安装依赖",
|
93
114
|
cwd: "项目路径"
|
94
115
|
}
|
95
116
|
};
|
@@ -101,7 +122,8 @@ var EN_LOCALE = {
|
|
101
122
|
distTag: `use specified tag version for it's generator`,
|
102
123
|
registry: "set npm registry url to run npm command",
|
103
124
|
debug: "using debug mode to log something",
|
104
|
-
cwd: "project path"
|
125
|
+
cwd: "project path",
|
126
|
+
noNeedInstall: "not run install command"
|
105
127
|
}
|
106
128
|
};
|
107
129
|
|
@@ -113,15 +135,12 @@ var localeKeys = i18n.init("en", { zh: ZH_LOCALE, en: EN_LOCALE });
|
|
113
135
|
function defineCommand(program) {
|
114
136
|
const locale = (0, import_language_detector.getLocaleLanguage)();
|
115
137
|
i18n.changeLanguage({ locale });
|
116
|
-
program.description(i18n.t(localeKeys.command.describe)).option("--dist-tag <distTag>", i18n.t(localeKeys.command.distTag), "").option("--registry <registry>", i18n.t(localeKeys.command.registry), "").option("-d,--debug", i18n.t(localeKeys.command.debug), false).option("--cwd <cwd>", i18n.t(localeKeys.command.cwd), "").action(
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
defineCommand(program);
|
121
|
-
program.parse(process.argv);
|
138
|
+
program.description(i18n.t(localeKeys.command.describe)).option("--dist-tag <distTag>", i18n.t(localeKeys.command.distTag), "").option("--registry <registry>", i18n.t(localeKeys.command.registry), "").option("-d,--debug", i18n.t(localeKeys.command.debug), false).option("--cwd <cwd>", i18n.t(localeKeys.command.cwd), "").option("--no-need-install", i18n.t(localeKeys.command.noNeedInstall)).action((params) => __async(this, null, function* () {
|
139
|
+
const { upgradeAction: upgradeAction2 } = yield Promise.resolve().then(() => (init_upgrade(), upgrade_exports));
|
140
|
+
return upgradeAction2(params);
|
141
|
+
}));
|
122
142
|
}
|
123
143
|
// Annotate the CommonJS export names for ESM import in node:
|
124
144
|
0 && (module.exports = {
|
125
|
-
defineCommand
|
126
|
-
upgradeAction
|
145
|
+
defineCommand
|
127
146
|
});
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.26.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/index.d.ts",
|
21
21
|
"main": "./dist/index.js",
|
@@ -38,8 +38,8 @@
|
|
38
38
|
},
|
39
39
|
"dependencies": {
|
40
40
|
"@modern-js/codesmith": "2.2.5",
|
41
|
-
"@modern-js/plugin-i18n": "2.
|
42
|
-
"@modern-js/utils": "2.
|
41
|
+
"@modern-js/plugin-i18n": "2.26.0",
|
42
|
+
"@modern-js/utils": "2.26.0"
|
43
43
|
},
|
44
44
|
"devDependencies": {
|
45
45
|
"@types/jest": "^29",
|
@@ -47,9 +47,9 @@
|
|
47
47
|
"jest": "^29",
|
48
48
|
"ts-node": "^10.9.1",
|
49
49
|
"typescript": "^5",
|
50
|
-
"@modern-js/upgrade-generator": "3.1.
|
51
|
-
"@scripts/
|
52
|
-
"@scripts/
|
50
|
+
"@modern-js/upgrade-generator": "3.1.28",
|
51
|
+
"@scripts/jest-config": "2.26.0",
|
52
|
+
"@scripts/build": "2.26.0"
|
53
53
|
},
|
54
54
|
"sideEffects": false,
|
55
55
|
"publishConfig": {
|