@modern-js/upgrade 2.27.0 → 2.28.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +346 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +31 -139
- package/dist/locale/en.d.ts +10 -0
- package/dist/locale/en.js +20 -0
- package/dist/locale/index.d.ts +22 -0
- package/dist/locale/index.js +27 -0
- package/dist/locale/zh.d.ts +10 -0
- package/dist/locale/zh.js +20 -0
- package/dist/upgrade.d.ts +8 -0
- package/dist/upgrade.js +44 -0
- package/package.json +7 -10
package/CHANGELOG.md
ADDED
@@ -0,0 +1,346 @@
|
|
1
|
+
# @modern-js/upgrade
|
2
|
+
|
3
|
+
## 2.28.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- d3e52e4: chore(CI): update build config to improve vitest CI perf
|
8
|
+
|
9
|
+
chore(CI): 更新构建配置来提升 vitest CI 性能
|
10
|
+
|
11
|
+
- Updated dependencies [00b58a7]
|
12
|
+
- @modern-js/utils@2.28.0
|
13
|
+
- @modern-js/plugin-i18n@2.28.0
|
14
|
+
|
15
|
+
## 2.27.0
|
16
|
+
|
17
|
+
### Patch Changes
|
18
|
+
|
19
|
+
- Updated dependencies [91d14b8]
|
20
|
+
- Updated dependencies [8322a51]
|
21
|
+
- Updated dependencies [6d7104d]
|
22
|
+
- @modern-js/utils@2.27.0
|
23
|
+
- @modern-js/plugin-i18n@2.27.0
|
24
|
+
|
25
|
+
## 2.26.0
|
26
|
+
|
27
|
+
### Patch Changes
|
28
|
+
|
29
|
+
- ad7139b: feat: upgrade commander support `--no-need-install` params
|
30
|
+
|
31
|
+
feat: upgrade 命令支持 `--no-need-install` 参数
|
32
|
+
|
33
|
+
- fbcac63: perf(cli): improve upgrade command load performance
|
34
|
+
|
35
|
+
perf(cli): 优化 upgrade 命令加载性能
|
36
|
+
|
37
|
+
- @modern-js/plugin-i18n@2.26.0
|
38
|
+
- @modern-js/utils@2.26.0
|
39
|
+
|
40
|
+
## 2.25.2
|
41
|
+
|
42
|
+
### Patch Changes
|
43
|
+
|
44
|
+
- Updated dependencies [63d8247]
|
45
|
+
- Updated dependencies [6651684]
|
46
|
+
- Updated dependencies [272646c]
|
47
|
+
- Updated dependencies [358ed24]
|
48
|
+
- @modern-js/utils@2.25.2
|
49
|
+
- @modern-js/plugin-i18n@2.25.2
|
50
|
+
|
51
|
+
## 2.25.1
|
52
|
+
|
53
|
+
### Patch Changes
|
54
|
+
|
55
|
+
- Updated dependencies [9f78d0c]
|
56
|
+
- @modern-js/utils@2.25.1
|
57
|
+
- @modern-js/plugin-i18n@2.25.1
|
58
|
+
|
59
|
+
## 2.25.0
|
60
|
+
|
61
|
+
### Patch Changes
|
62
|
+
|
63
|
+
- Updated dependencies [5732c6a]
|
64
|
+
- @modern-js/utils@2.25.0
|
65
|
+
- @modern-js/plugin-i18n@2.25.0
|
66
|
+
|
67
|
+
## 2.24.0
|
68
|
+
|
69
|
+
### Patch Changes
|
70
|
+
|
71
|
+
- Updated dependencies [c882fbd]
|
72
|
+
- Updated dependencies [4a82c3b]
|
73
|
+
- @modern-js/utils@2.24.0
|
74
|
+
- @modern-js/plugin-i18n@2.24.0
|
75
|
+
|
76
|
+
## 2.23.1
|
77
|
+
|
78
|
+
### Patch Changes
|
79
|
+
|
80
|
+
- Updated dependencies [f08bbfc]
|
81
|
+
- Updated dependencies [a6b313a]
|
82
|
+
- Updated dependencies [8f2cab0]
|
83
|
+
- @modern-js/utils@2.23.1
|
84
|
+
- @modern-js/plugin-i18n@2.23.1
|
85
|
+
|
86
|
+
## 2.23.0
|
87
|
+
|
88
|
+
### Patch Changes
|
89
|
+
|
90
|
+
- 7e6fb5f: chore: publishConfig add provenance config
|
91
|
+
|
92
|
+
chore: publishConfig 增加 provenance 配置
|
93
|
+
|
94
|
+
- Updated dependencies [7e6fb5f]
|
95
|
+
- Updated dependencies [a7a7ad7]
|
96
|
+
- Updated dependencies [6dec7c2]
|
97
|
+
- Updated dependencies [c3216b5]
|
98
|
+
- @modern-js/plugin-i18n@2.23.0
|
99
|
+
- @modern-js/utils@2.23.0
|
100
|
+
|
101
|
+
## 2.22.1
|
102
|
+
|
103
|
+
### Patch Changes
|
104
|
+
|
105
|
+
- Updated dependencies [e2848a2]
|
106
|
+
- Updated dependencies [d4045ed]
|
107
|
+
- @modern-js/utils@2.22.1
|
108
|
+
- @modern-js/plugin-i18n@2.22.1
|
109
|
+
|
110
|
+
## 2.22.0
|
111
|
+
|
112
|
+
### Patch Changes
|
113
|
+
|
114
|
+
- b647c68: chore(generator): update codesmith version
|
115
|
+
|
116
|
+
chore(generator): 更新 codesmith 版本
|
117
|
+
|
118
|
+
- Updated dependencies [3d48836]
|
119
|
+
- Updated dependencies [5050e8e]
|
120
|
+
- @modern-js/utils@2.22.0
|
121
|
+
- @modern-js/plugin-i18n@2.22.0
|
122
|
+
|
123
|
+
## 2.21.1
|
124
|
+
|
125
|
+
### Patch Changes
|
126
|
+
|
127
|
+
- @modern-js/plugin-i18n@2.21.1
|
128
|
+
- @modern-js/utils@2.21.1
|
129
|
+
|
130
|
+
## 2.21.0
|
131
|
+
|
132
|
+
### Patch Changes
|
133
|
+
|
134
|
+
- 26dcf3a: chore: bump typescript to v5 in devDependencies
|
135
|
+
|
136
|
+
chore: 升级 devDependencies 中的 typescript 版本到 v5
|
137
|
+
|
138
|
+
- de8f73f: feat: update codesmith version
|
139
|
+
|
140
|
+
feat: 更新 codesmith 版本
|
141
|
+
|
142
|
+
- Updated dependencies [e81eeaf]
|
143
|
+
- Updated dependencies [26dcf3a]
|
144
|
+
- Updated dependencies [056627f]
|
145
|
+
- Updated dependencies [0fc15ca]
|
146
|
+
- Updated dependencies [43b4e83]
|
147
|
+
- Updated dependencies [ad78387]
|
148
|
+
- @modern-js/utils@2.21.0
|
149
|
+
- @modern-js/plugin-i18n@2.21.0
|
150
|
+
|
151
|
+
## 2.20.0
|
152
|
+
|
153
|
+
### Patch Changes
|
154
|
+
|
155
|
+
- 6b9d90a: chore: remove @babel/runtime. add @swc/helper and enable `externalHelper` config.
|
156
|
+
chore: 移除 @babel/runtime 依赖. 增加 @swc/helpers 依赖并且开启 `externalHelpers` 配置
|
157
|
+
- Updated dependencies [3c4e0a5]
|
158
|
+
- Updated dependencies [6b9d90a]
|
159
|
+
- @modern-js/utils@2.20.0
|
160
|
+
- @modern-js/plugin-i18n@2.20.0
|
161
|
+
|
162
|
+
## 2.19.1
|
163
|
+
|
164
|
+
### Patch Changes
|
165
|
+
|
166
|
+
- @modern-js/plugin-i18n@2.19.1
|
167
|
+
- @modern-js/utils@2.19.1
|
168
|
+
|
169
|
+
## 2.19.0
|
170
|
+
|
171
|
+
### Patch Changes
|
172
|
+
|
173
|
+
- Updated dependencies [1134fe2]
|
174
|
+
- @modern-js/utils@2.19.0
|
175
|
+
- @modern-js/plugin-i18n@2.19.0
|
176
|
+
|
177
|
+
## 2.18.1
|
178
|
+
|
179
|
+
### Patch Changes
|
180
|
+
|
181
|
+
- 21c87bf: feat: bump codesmith packages version
|
182
|
+
|
183
|
+
feat: 升级 codesmith 包版本
|
184
|
+
|
185
|
+
- bc61dab: feat: bump codesmith version
|
186
|
+
|
187
|
+
feat: 升级 codesmith 版本
|
188
|
+
|
189
|
+
- @modern-js/plugin-i18n@2.18.1
|
190
|
+
- @modern-js/utils@2.18.1
|
191
|
+
|
192
|
+
## 2.18.0
|
193
|
+
|
194
|
+
### Patch Changes
|
195
|
+
|
196
|
+
- @modern-js/plugin-i18n@2.18.0
|
197
|
+
- @modern-js/utils@2.18.0
|
198
|
+
|
199
|
+
## 2.17.1
|
200
|
+
|
201
|
+
### Patch Changes
|
202
|
+
|
203
|
+
- @modern-js/plugin-i18n@2.17.1
|
204
|
+
- @modern-js/utils@2.17.1
|
205
|
+
|
206
|
+
## 2.17.0
|
207
|
+
|
208
|
+
### Patch Changes
|
209
|
+
|
210
|
+
- @modern-js/plugin-i18n@2.17.0
|
211
|
+
- @modern-js/utils@2.17.0
|
212
|
+
|
213
|
+
## 2.16.0
|
214
|
+
|
215
|
+
### Patch Changes
|
216
|
+
|
217
|
+
- 4e876ab: chore: package.json include the monorepo-relative directory
|
218
|
+
|
219
|
+
chore: 在 package.json 中声明 monorepo 的子路径
|
220
|
+
|
221
|
+
- Updated dependencies [5954330]
|
222
|
+
- Updated dependencies [7596520]
|
223
|
+
- Updated dependencies [4e876ab]
|
224
|
+
- @modern-js/utils@2.16.0
|
225
|
+
- @modern-js/plugin-i18n@2.16.0
|
226
|
+
|
227
|
+
## 2.15.0
|
228
|
+
|
229
|
+
### Patch Changes
|
230
|
+
|
231
|
+
- @modern-js/plugin-i18n@2.15.0
|
232
|
+
- @modern-js/utils@2.15.0
|
233
|
+
|
234
|
+
## 2.14.0
|
235
|
+
|
236
|
+
### Patch Changes
|
237
|
+
|
238
|
+
- Updated dependencies [4779152]
|
239
|
+
- Updated dependencies [9321bef]
|
240
|
+
- Updated dependencies [9b45c58]
|
241
|
+
- Updated dependencies [52d0cb1]
|
242
|
+
- Updated dependencies [60a81d0]
|
243
|
+
- Updated dependencies [dacef96]
|
244
|
+
- Updated dependencies [16399fd]
|
245
|
+
- @modern-js/utils@2.14.0
|
246
|
+
- @modern-js/plugin-i18n@2.14.0
|
247
|
+
|
248
|
+
## 2.13.4
|
249
|
+
|
250
|
+
### Patch Changes
|
251
|
+
|
252
|
+
- @modern-js/plugin-i18n@2.13.4
|
253
|
+
- @modern-js/utils@2.13.4
|
254
|
+
|
255
|
+
## 2.13.3
|
256
|
+
|
257
|
+
### Patch Changes
|
258
|
+
|
259
|
+
- @modern-js/plugin-i18n@2.13.3
|
260
|
+
- @modern-js/utils@2.13.3
|
261
|
+
|
262
|
+
## 2.13.2
|
263
|
+
|
264
|
+
### Patch Changes
|
265
|
+
|
266
|
+
- @modern-js/plugin-i18n@2.13.2
|
267
|
+
- @modern-js/utils@2.13.2
|
268
|
+
|
269
|
+
## 2.13.1
|
270
|
+
|
271
|
+
### Patch Changes
|
272
|
+
|
273
|
+
- @modern-js/plugin-i18n@2.13.1
|
274
|
+
- @modern-js/utils@2.13.1
|
275
|
+
|
276
|
+
## 2.13.0
|
277
|
+
|
278
|
+
### Patch Changes
|
279
|
+
|
280
|
+
- 034f36b: feat: set the default language of CLI to English
|
281
|
+
|
282
|
+
feat: 将命令行的默认语言设置为英文
|
283
|
+
|
284
|
+
- 034f36b: fix(upgrade): i18n of upgrade command not work
|
285
|
+
|
286
|
+
fix(upgrade): 修复 upgrade 命令的 i18n 配置不生效的问题
|
287
|
+
|
288
|
+
- Updated dependencies [034f36b]
|
289
|
+
- Updated dependencies [034f36b]
|
290
|
+
- @modern-js/plugin-i18n@2.13.0
|
291
|
+
- @modern-js/utils@2.13.0
|
292
|
+
|
293
|
+
## 2.12.0
|
294
|
+
|
295
|
+
### Patch Changes
|
296
|
+
|
297
|
+
- Updated dependencies [c2ca6c8]
|
298
|
+
- Updated dependencies [6d86e34]
|
299
|
+
- @modern-js/utils@2.12.0
|
300
|
+
- @modern-js/plugin-i18n@2.12.0
|
301
|
+
|
302
|
+
## 2.11.0
|
303
|
+
|
304
|
+
### Patch Changes
|
305
|
+
|
306
|
+
- Updated dependencies [cfb058f]
|
307
|
+
- Updated dependencies [0bd018b]
|
308
|
+
- Updated dependencies [5d624fd]
|
309
|
+
- Updated dependencies [e2466a1]
|
310
|
+
- Updated dependencies [02bb383]
|
311
|
+
- Updated dependencies [381a3b9]
|
312
|
+
- Updated dependencies [7a60f10]
|
313
|
+
- Updated dependencies [274b2e5]
|
314
|
+
- Updated dependencies [b9e1c54]
|
315
|
+
- @modern-js/utils@2.11.0
|
316
|
+
- @modern-js/plugin-i18n@2.11.0
|
317
|
+
|
318
|
+
## 2.10.0
|
319
|
+
|
320
|
+
### Patch Changes
|
321
|
+
|
322
|
+
- 0da32d0: chore: upgrade jest and puppeteer
|
323
|
+
chore: 升级 jest 和 puppeteer 到 latest
|
324
|
+
- Updated dependencies [0da32d0]
|
325
|
+
- Updated dependencies [0d9962b]
|
326
|
+
- Updated dependencies [fbefa7e]
|
327
|
+
- Updated dependencies [4d54233]
|
328
|
+
- Updated dependencies [6db4864]
|
329
|
+
- @modern-js/plugin-i18n@2.10.0
|
330
|
+
- @modern-js/utils@2.10.0
|
331
|
+
|
332
|
+
## 2.9.0
|
333
|
+
|
334
|
+
### Patch Changes
|
335
|
+
|
336
|
+
- @modern-js/plugin-i18n@2.9.0
|
337
|
+
- @modern-js/utils@2.9.0
|
338
|
+
|
339
|
+
## 2.8.0
|
340
|
+
|
341
|
+
### Patch Changes
|
342
|
+
|
343
|
+
- Updated dependencies [1104a9f18b]
|
344
|
+
- Updated dependencies [1f6ca2c7fb]
|
345
|
+
- @modern-js/utils@2.8.0
|
346
|
+
- @modern-js/plugin-i18n@2.8.0
|
package/dist/index.d.ts
ADDED
package/dist/index.js
CHANGED
@@ -1,146 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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
|
-
};
|
8
|
-
var __export = (target, all) => {
|
9
|
-
for (var name in all)
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
-
};
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
-
for (let key of __getOwnPropNames(from))
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
-
}
|
18
|
-
return to;
|
19
|
-
};
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
21
|
-
var __async = (__this, __arguments, generator) => {
|
22
|
-
return new Promise((resolve, reject) => {
|
23
|
-
var fulfilled = (value) => {
|
24
|
-
try {
|
25
|
-
step(generator.next(value));
|
26
|
-
} catch (e) {
|
27
|
-
reject(e);
|
28
|
-
}
|
29
|
-
};
|
30
|
-
var rejected = (value) => {
|
31
|
-
try {
|
32
|
-
step(generator.throw(value));
|
33
|
-
} catch (e) {
|
34
|
-
reject(e);
|
35
|
-
}
|
36
|
-
};
|
37
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
38
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
39
|
-
});
|
40
|
-
};
|
41
|
-
|
42
|
-
// src/upgrade.ts
|
43
|
-
var upgrade_exports = {};
|
44
|
-
__export(upgrade_exports, {
|
45
|
-
upgradeAction: () => upgradeAction
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
46
4
|
});
|
47
|
-
function
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
distTag,
|
53
|
-
registry,
|
54
|
-
needInstall
|
55
|
-
} = options;
|
56
|
-
const projectDir = cwd;
|
57
|
-
const smith = new import_codesmith.CodeSmith({
|
58
|
-
debug
|
5
|
+
function _export(target, all) {
|
6
|
+
for (var name in all)
|
7
|
+
Object.defineProperty(target, name, {
|
8
|
+
enumerable: true,
|
9
|
+
get: all[name]
|
59
10
|
});
|
60
|
-
smith.logger.debug("@modern-js/upgrade", projectDir || "", options);
|
61
|
-
let generator = UPGRADE_GENERATOR;
|
62
|
-
if (process.env.CODESMITH_ENV === "development") {
|
63
|
-
generator = require.resolve(UPGRADE_GENERATOR);
|
64
|
-
} else if (distTag) {
|
65
|
-
generator = `${UPGRADE_GENERATOR}@${distTag}`;
|
66
|
-
}
|
67
|
-
try {
|
68
|
-
yield smith.forge({
|
69
|
-
tasks: [
|
70
|
-
{
|
71
|
-
generator,
|
72
|
-
config: {
|
73
|
-
debug,
|
74
|
-
distTag,
|
75
|
-
registry,
|
76
|
-
noNeedInstall: !needInstall
|
77
|
-
}
|
78
|
-
}
|
79
|
-
],
|
80
|
-
pwd: cwd
|
81
|
-
});
|
82
|
-
} catch (e) {
|
83
|
-
process.exit(1);
|
84
|
-
}
|
85
|
-
});
|
86
11
|
}
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
12
|
+
_export(exports, {
|
13
|
+
defineCommand: function() {
|
14
|
+
return defineCommand;
|
15
|
+
},
|
16
|
+
default: function() {
|
17
|
+
return _default;
|
92
18
|
}
|
93
19
|
});
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
defineCommand: () => defineCommand
|
99
|
-
});
|
100
|
-
module.exports = __toCommonJS(src_exports);
|
101
|
-
var import_language_detector = require("@modern-js/plugin-i18n/language-detector");
|
102
|
-
|
103
|
-
// src/locale/index.ts
|
104
|
-
var import_plugin_i18n = require("@modern-js/plugin-i18n");
|
105
|
-
|
106
|
-
// src/locale/zh.ts
|
107
|
-
var ZH_LOCALE = {
|
108
|
-
command: {
|
109
|
-
describe: "升级 Modern.js 到最新版本",
|
110
|
-
distTag: "升级时底层生成器使用特殊的 npm Tag",
|
111
|
-
registry: "定制 npm registry",
|
112
|
-
debug: "开启 Debug 模式,打印调试日志信息",
|
113
|
-
noNeedInstall: "无需安装依赖",
|
114
|
-
cwd: "项目路径"
|
115
|
-
}
|
116
|
-
};
|
117
|
-
|
118
|
-
// src/locale/en.ts
|
119
|
-
var EN_LOCALE = {
|
120
|
-
command: {
|
121
|
-
describe: "upgrade modern package to latest",
|
122
|
-
distTag: `use specified tag version for it's generator`,
|
123
|
-
registry: "set npm registry url to run npm command",
|
124
|
-
debug: "using debug mode to log something",
|
125
|
-
cwd: "project path",
|
126
|
-
noNeedInstall: "not run install command"
|
127
|
-
}
|
128
|
-
};
|
129
|
-
|
130
|
-
// src/locale/index.ts
|
131
|
-
var i18n = new import_plugin_i18n.I18n();
|
132
|
-
var localeKeys = i18n.init("en", { zh: ZH_LOCALE, en: EN_LOCALE });
|
133
|
-
|
134
|
-
// src/index.ts
|
20
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
21
|
+
const _languagedetector = require("@modern-js/plugin-i18n/language-detector");
|
22
|
+
const _commander = require("@modern-js/utils/commander");
|
23
|
+
const _locale = require("./locale");
|
135
24
|
function defineCommand(program) {
|
136
|
-
const locale = (0,
|
137
|
-
i18n.changeLanguage({
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
25
|
+
const locale = (0, _languagedetector.getLocaleLanguage)();
|
26
|
+
_locale.i18n.changeLanguage({
|
27
|
+
locale
|
28
|
+
});
|
29
|
+
program.description(_locale.i18n.t(_locale.localeKeys.command.describe)).option("--dist-tag <distTag>", _locale.i18n.t(_locale.localeKeys.command.distTag), "").option("--registry <registry>", _locale.i18n.t(_locale.localeKeys.command.registry), "").option("-d,--debug", _locale.i18n.t(_locale.localeKeys.command.debug), false).option("--cwd <cwd>", _locale.i18n.t(_locale.localeKeys.command.cwd), "").option("--no-need-install", _locale.i18n.t(_locale.localeKeys.command.noNeedInstall)).action(async (params) => {
|
30
|
+
const { upgradeAction } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./upgrade")));
|
31
|
+
return upgradeAction(params);
|
32
|
+
});
|
142
33
|
}
|
143
|
-
|
144
|
-
|
145
|
-
defineCommand
|
146
|
-
|
34
|
+
const _default = () => {
|
35
|
+
const program = new _commander.Command();
|
36
|
+
defineCommand(program);
|
37
|
+
program.parse(process.argv);
|
38
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "EN_LOCALE", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return EN_LOCALE;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const EN_LOCALE = {
|
12
|
+
command: {
|
13
|
+
describe: "upgrade modern package to latest",
|
14
|
+
distTag: `use specified tag version for it's generator`,
|
15
|
+
registry: "set npm registry url to run npm command",
|
16
|
+
debug: "using debug mode to log something",
|
17
|
+
cwd: "project path",
|
18
|
+
noNeedInstall: "not run install command"
|
19
|
+
}
|
20
|
+
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { I18n } from '@modern-js/plugin-i18n';
|
2
|
+
declare const i18n: I18n;
|
3
|
+
declare const localeKeys: {
|
4
|
+
command: {
|
5
|
+
describe: string;
|
6
|
+
distTag: string;
|
7
|
+
registry: string;
|
8
|
+
debug: string;
|
9
|
+
noNeedInstall: string;
|
10
|
+
cwd: string;
|
11
|
+
};
|
12
|
+
} | {
|
13
|
+
command: {
|
14
|
+
describe: string;
|
15
|
+
distTag: string;
|
16
|
+
registry: string;
|
17
|
+
debug: string;
|
18
|
+
cwd: string;
|
19
|
+
noNeedInstall: string;
|
20
|
+
};
|
21
|
+
};
|
22
|
+
export { i18n, localeKeys };
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for (var name in all)
|
7
|
+
Object.defineProperty(target, name, {
|
8
|
+
enumerable: true,
|
9
|
+
get: all[name]
|
10
|
+
});
|
11
|
+
}
|
12
|
+
_export(exports, {
|
13
|
+
i18n: function() {
|
14
|
+
return i18n;
|
15
|
+
},
|
16
|
+
localeKeys: function() {
|
17
|
+
return localeKeys;
|
18
|
+
}
|
19
|
+
});
|
20
|
+
const _plugini18n = require("@modern-js/plugin-i18n");
|
21
|
+
const _zh = require("./zh");
|
22
|
+
const _en = require("./en");
|
23
|
+
const i18n = new _plugini18n.I18n();
|
24
|
+
const localeKeys = i18n.init("en", {
|
25
|
+
zh: _zh.ZH_LOCALE,
|
26
|
+
en: _en.EN_LOCALE
|
27
|
+
});
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "ZH_LOCALE", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return ZH_LOCALE;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const ZH_LOCALE = {
|
12
|
+
command: {
|
13
|
+
describe: "升级 Modern.js 到最新版本",
|
14
|
+
distTag: "升级时底层生成器使用特殊的 npm Tag",
|
15
|
+
registry: "定制 npm registry",
|
16
|
+
debug: "开启 Debug 模式,打印调试日志信息",
|
17
|
+
noNeedInstall: "无需安装依赖",
|
18
|
+
cwd: "项目路径"
|
19
|
+
}
|
20
|
+
};
|
package/dist/upgrade.js
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "upgradeAction", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return upgradeAction;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _codesmith = require("@modern-js/codesmith");
|
12
|
+
const UPGRADE_GENERATOR = "@modern-js/upgrade-generator";
|
13
|
+
async function upgradeAction(options) {
|
14
|
+
const { cwd = process.cwd(), debug = false, distTag, registry, needInstall } = options;
|
15
|
+
const projectDir = cwd;
|
16
|
+
const smith = new _codesmith.CodeSmith({
|
17
|
+
debug
|
18
|
+
});
|
19
|
+
smith.logger.debug("@modern-js/upgrade", projectDir || "", options);
|
20
|
+
let generator = UPGRADE_GENERATOR;
|
21
|
+
if (process.env.CODESMITH_ENV === "development") {
|
22
|
+
generator = require.resolve(UPGRADE_GENERATOR);
|
23
|
+
} else if (distTag) {
|
24
|
+
generator = `${UPGRADE_GENERATOR}@${distTag}`;
|
25
|
+
}
|
26
|
+
try {
|
27
|
+
await smith.forge({
|
28
|
+
tasks: [
|
29
|
+
{
|
30
|
+
generator,
|
31
|
+
config: {
|
32
|
+
debug,
|
33
|
+
distTag,
|
34
|
+
registry,
|
35
|
+
noNeedInstall: !needInstall
|
36
|
+
}
|
37
|
+
}
|
38
|
+
],
|
39
|
+
pwd: cwd
|
40
|
+
});
|
41
|
+
} catch (e) {
|
42
|
+
process.exit(1);
|
43
|
+
}
|
44
|
+
}
|
package/package.json
CHANGED
@@ -15,17 +15,13 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.28.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/index.d.ts",
|
21
21
|
"main": "./dist/index.js",
|
22
22
|
"bin": {
|
23
23
|
"create": "./bin/run.js"
|
24
24
|
},
|
25
|
-
"files": [
|
26
|
-
"/bin",
|
27
|
-
"/dist/index.js"
|
28
|
-
],
|
29
25
|
"exports": {
|
30
26
|
".": {
|
31
27
|
"node": {
|
@@ -38,8 +34,9 @@
|
|
38
34
|
},
|
39
35
|
"dependencies": {
|
40
36
|
"@modern-js/codesmith": "2.2.5",
|
41
|
-
"@
|
42
|
-
"@modern-js/
|
37
|
+
"@swc/helpers": "0.5.1",
|
38
|
+
"@modern-js/plugin-i18n": "2.28.0",
|
39
|
+
"@modern-js/utils": "2.28.0"
|
43
40
|
},
|
44
41
|
"devDependencies": {
|
45
42
|
"@types/jest": "^29",
|
@@ -47,9 +44,9 @@
|
|
47
44
|
"jest": "^29",
|
48
45
|
"ts-node": "^10.9.1",
|
49
46
|
"typescript": "^5",
|
50
|
-
"@modern-js/upgrade-generator": "3.1.
|
51
|
-
"@scripts/build": "2.
|
52
|
-
"@scripts/jest-config": "2.
|
47
|
+
"@modern-js/upgrade-generator": "3.1.30",
|
48
|
+
"@scripts/build": "2.28.0",
|
49
|
+
"@scripts/jest-config": "2.28.0"
|
53
50
|
},
|
54
51
|
"sideEffects": false,
|
55
52
|
"publishConfig": {
|