@modern-js/upgrade 2.26.0 → 2.27.1-alpha.0
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 +334 -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 +8 -12
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
# @modern-js/upgrade
|
|
2
|
+
|
|
3
|
+
## 2.27.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [91d14b8]
|
|
8
|
+
- Updated dependencies [8322a51]
|
|
9
|
+
- Updated dependencies [6d7104d]
|
|
10
|
+
- @modern-js/utils@2.27.0
|
|
11
|
+
- @modern-js/plugin-i18n@2.27.0
|
|
12
|
+
|
|
13
|
+
## 2.26.0
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- ad7139b: feat: upgrade commander support `--no-need-install` params
|
|
18
|
+
|
|
19
|
+
feat: upgrade 命令支持 `--no-need-install` 参数
|
|
20
|
+
|
|
21
|
+
- fbcac63: perf(cli): improve upgrade command load performance
|
|
22
|
+
|
|
23
|
+
perf(cli): 优化 upgrade 命令加载性能
|
|
24
|
+
|
|
25
|
+
- @modern-js/plugin-i18n@2.26.0
|
|
26
|
+
- @modern-js/utils@2.26.0
|
|
27
|
+
|
|
28
|
+
## 2.25.2
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [63d8247]
|
|
33
|
+
- Updated dependencies [6651684]
|
|
34
|
+
- Updated dependencies [272646c]
|
|
35
|
+
- Updated dependencies [358ed24]
|
|
36
|
+
- @modern-js/utils@2.25.2
|
|
37
|
+
- @modern-js/plugin-i18n@2.25.2
|
|
38
|
+
|
|
39
|
+
## 2.25.1
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [9f78d0c]
|
|
44
|
+
- @modern-js/utils@2.25.1
|
|
45
|
+
- @modern-js/plugin-i18n@2.25.1
|
|
46
|
+
|
|
47
|
+
## 2.25.0
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Updated dependencies [5732c6a]
|
|
52
|
+
- @modern-js/utils@2.25.0
|
|
53
|
+
- @modern-js/plugin-i18n@2.25.0
|
|
54
|
+
|
|
55
|
+
## 2.24.0
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- Updated dependencies [c882fbd]
|
|
60
|
+
- Updated dependencies [4a82c3b]
|
|
61
|
+
- @modern-js/utils@2.24.0
|
|
62
|
+
- @modern-js/plugin-i18n@2.24.0
|
|
63
|
+
|
|
64
|
+
## 2.23.1
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Updated dependencies [f08bbfc]
|
|
69
|
+
- Updated dependencies [a6b313a]
|
|
70
|
+
- Updated dependencies [8f2cab0]
|
|
71
|
+
- @modern-js/utils@2.23.1
|
|
72
|
+
- @modern-js/plugin-i18n@2.23.1
|
|
73
|
+
|
|
74
|
+
## 2.23.0
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- 7e6fb5f: chore: publishConfig add provenance config
|
|
79
|
+
|
|
80
|
+
chore: publishConfig 增加 provenance 配置
|
|
81
|
+
|
|
82
|
+
- Updated dependencies [7e6fb5f]
|
|
83
|
+
- Updated dependencies [a7a7ad7]
|
|
84
|
+
- Updated dependencies [6dec7c2]
|
|
85
|
+
- Updated dependencies [c3216b5]
|
|
86
|
+
- @modern-js/plugin-i18n@2.23.0
|
|
87
|
+
- @modern-js/utils@2.23.0
|
|
88
|
+
|
|
89
|
+
## 2.22.1
|
|
90
|
+
|
|
91
|
+
### Patch Changes
|
|
92
|
+
|
|
93
|
+
- Updated dependencies [e2848a2]
|
|
94
|
+
- Updated dependencies [d4045ed]
|
|
95
|
+
- @modern-js/utils@2.22.1
|
|
96
|
+
- @modern-js/plugin-i18n@2.22.1
|
|
97
|
+
|
|
98
|
+
## 2.22.0
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- b647c68: chore(generator): update codesmith version
|
|
103
|
+
|
|
104
|
+
chore(generator): 更新 codesmith 版本
|
|
105
|
+
|
|
106
|
+
- Updated dependencies [3d48836]
|
|
107
|
+
- Updated dependencies [5050e8e]
|
|
108
|
+
- @modern-js/utils@2.22.0
|
|
109
|
+
- @modern-js/plugin-i18n@2.22.0
|
|
110
|
+
|
|
111
|
+
## 2.21.1
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- @modern-js/plugin-i18n@2.21.1
|
|
116
|
+
- @modern-js/utils@2.21.1
|
|
117
|
+
|
|
118
|
+
## 2.21.0
|
|
119
|
+
|
|
120
|
+
### Patch Changes
|
|
121
|
+
|
|
122
|
+
- 26dcf3a: chore: bump typescript to v5 in devDependencies
|
|
123
|
+
|
|
124
|
+
chore: 升级 devDependencies 中的 typescript 版本到 v5
|
|
125
|
+
|
|
126
|
+
- de8f73f: feat: update codesmith version
|
|
127
|
+
|
|
128
|
+
feat: 更新 codesmith 版本
|
|
129
|
+
|
|
130
|
+
- Updated dependencies [e81eeaf]
|
|
131
|
+
- Updated dependencies [26dcf3a]
|
|
132
|
+
- Updated dependencies [056627f]
|
|
133
|
+
- Updated dependencies [0fc15ca]
|
|
134
|
+
- Updated dependencies [43b4e83]
|
|
135
|
+
- Updated dependencies [ad78387]
|
|
136
|
+
- @modern-js/utils@2.21.0
|
|
137
|
+
- @modern-js/plugin-i18n@2.21.0
|
|
138
|
+
|
|
139
|
+
## 2.20.0
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- 6b9d90a: chore: remove @babel/runtime. add @swc/helper and enable `externalHelper` config.
|
|
144
|
+
chore: 移除 @babel/runtime 依赖. 增加 @swc/helpers 依赖并且开启 `externalHelpers` 配置
|
|
145
|
+
- Updated dependencies [3c4e0a5]
|
|
146
|
+
- Updated dependencies [6b9d90a]
|
|
147
|
+
- @modern-js/utils@2.20.0
|
|
148
|
+
- @modern-js/plugin-i18n@2.20.0
|
|
149
|
+
|
|
150
|
+
## 2.19.1
|
|
151
|
+
|
|
152
|
+
### Patch Changes
|
|
153
|
+
|
|
154
|
+
- @modern-js/plugin-i18n@2.19.1
|
|
155
|
+
- @modern-js/utils@2.19.1
|
|
156
|
+
|
|
157
|
+
## 2.19.0
|
|
158
|
+
|
|
159
|
+
### Patch Changes
|
|
160
|
+
|
|
161
|
+
- Updated dependencies [1134fe2]
|
|
162
|
+
- @modern-js/utils@2.19.0
|
|
163
|
+
- @modern-js/plugin-i18n@2.19.0
|
|
164
|
+
|
|
165
|
+
## 2.18.1
|
|
166
|
+
|
|
167
|
+
### Patch Changes
|
|
168
|
+
|
|
169
|
+
- 21c87bf: feat: bump codesmith packages version
|
|
170
|
+
|
|
171
|
+
feat: 升级 codesmith 包版本
|
|
172
|
+
|
|
173
|
+
- bc61dab: feat: bump codesmith version
|
|
174
|
+
|
|
175
|
+
feat: 升级 codesmith 版本
|
|
176
|
+
|
|
177
|
+
- @modern-js/plugin-i18n@2.18.1
|
|
178
|
+
- @modern-js/utils@2.18.1
|
|
179
|
+
|
|
180
|
+
## 2.18.0
|
|
181
|
+
|
|
182
|
+
### Patch Changes
|
|
183
|
+
|
|
184
|
+
- @modern-js/plugin-i18n@2.18.0
|
|
185
|
+
- @modern-js/utils@2.18.0
|
|
186
|
+
|
|
187
|
+
## 2.17.1
|
|
188
|
+
|
|
189
|
+
### Patch Changes
|
|
190
|
+
|
|
191
|
+
- @modern-js/plugin-i18n@2.17.1
|
|
192
|
+
- @modern-js/utils@2.17.1
|
|
193
|
+
|
|
194
|
+
## 2.17.0
|
|
195
|
+
|
|
196
|
+
### Patch Changes
|
|
197
|
+
|
|
198
|
+
- @modern-js/plugin-i18n@2.17.0
|
|
199
|
+
- @modern-js/utils@2.17.0
|
|
200
|
+
|
|
201
|
+
## 2.16.0
|
|
202
|
+
|
|
203
|
+
### Patch Changes
|
|
204
|
+
|
|
205
|
+
- 4e876ab: chore: package.json include the monorepo-relative directory
|
|
206
|
+
|
|
207
|
+
chore: 在 package.json 中声明 monorepo 的子路径
|
|
208
|
+
|
|
209
|
+
- Updated dependencies [5954330]
|
|
210
|
+
- Updated dependencies [7596520]
|
|
211
|
+
- Updated dependencies [4e876ab]
|
|
212
|
+
- @modern-js/utils@2.16.0
|
|
213
|
+
- @modern-js/plugin-i18n@2.16.0
|
|
214
|
+
|
|
215
|
+
## 2.15.0
|
|
216
|
+
|
|
217
|
+
### Patch Changes
|
|
218
|
+
|
|
219
|
+
- @modern-js/plugin-i18n@2.15.0
|
|
220
|
+
- @modern-js/utils@2.15.0
|
|
221
|
+
|
|
222
|
+
## 2.14.0
|
|
223
|
+
|
|
224
|
+
### Patch Changes
|
|
225
|
+
|
|
226
|
+
- Updated dependencies [4779152]
|
|
227
|
+
- Updated dependencies [9321bef]
|
|
228
|
+
- Updated dependencies [9b45c58]
|
|
229
|
+
- Updated dependencies [52d0cb1]
|
|
230
|
+
- Updated dependencies [60a81d0]
|
|
231
|
+
- Updated dependencies [dacef96]
|
|
232
|
+
- Updated dependencies [16399fd]
|
|
233
|
+
- @modern-js/utils@2.14.0
|
|
234
|
+
- @modern-js/plugin-i18n@2.14.0
|
|
235
|
+
|
|
236
|
+
## 2.13.4
|
|
237
|
+
|
|
238
|
+
### Patch Changes
|
|
239
|
+
|
|
240
|
+
- @modern-js/plugin-i18n@2.13.4
|
|
241
|
+
- @modern-js/utils@2.13.4
|
|
242
|
+
|
|
243
|
+
## 2.13.3
|
|
244
|
+
|
|
245
|
+
### Patch Changes
|
|
246
|
+
|
|
247
|
+
- @modern-js/plugin-i18n@2.13.3
|
|
248
|
+
- @modern-js/utils@2.13.3
|
|
249
|
+
|
|
250
|
+
## 2.13.2
|
|
251
|
+
|
|
252
|
+
### Patch Changes
|
|
253
|
+
|
|
254
|
+
- @modern-js/plugin-i18n@2.13.2
|
|
255
|
+
- @modern-js/utils@2.13.2
|
|
256
|
+
|
|
257
|
+
## 2.13.1
|
|
258
|
+
|
|
259
|
+
### Patch Changes
|
|
260
|
+
|
|
261
|
+
- @modern-js/plugin-i18n@2.13.1
|
|
262
|
+
- @modern-js/utils@2.13.1
|
|
263
|
+
|
|
264
|
+
## 2.13.0
|
|
265
|
+
|
|
266
|
+
### Patch Changes
|
|
267
|
+
|
|
268
|
+
- 034f36b: feat: set the default language of CLI to English
|
|
269
|
+
|
|
270
|
+
feat: 将命令行的默认语言设置为英文
|
|
271
|
+
|
|
272
|
+
- 034f36b: fix(upgrade): i18n of upgrade command not work
|
|
273
|
+
|
|
274
|
+
fix(upgrade): 修复 upgrade 命令的 i18n 配置不生效的问题
|
|
275
|
+
|
|
276
|
+
- Updated dependencies [034f36b]
|
|
277
|
+
- Updated dependencies [034f36b]
|
|
278
|
+
- @modern-js/plugin-i18n@2.13.0
|
|
279
|
+
- @modern-js/utils@2.13.0
|
|
280
|
+
|
|
281
|
+
## 2.12.0
|
|
282
|
+
|
|
283
|
+
### Patch Changes
|
|
284
|
+
|
|
285
|
+
- Updated dependencies [c2ca6c8]
|
|
286
|
+
- Updated dependencies [6d86e34]
|
|
287
|
+
- @modern-js/utils@2.12.0
|
|
288
|
+
- @modern-js/plugin-i18n@2.12.0
|
|
289
|
+
|
|
290
|
+
## 2.11.0
|
|
291
|
+
|
|
292
|
+
### Patch Changes
|
|
293
|
+
|
|
294
|
+
- Updated dependencies [cfb058f]
|
|
295
|
+
- Updated dependencies [0bd018b]
|
|
296
|
+
- Updated dependencies [5d624fd]
|
|
297
|
+
- Updated dependencies [e2466a1]
|
|
298
|
+
- Updated dependencies [02bb383]
|
|
299
|
+
- Updated dependencies [381a3b9]
|
|
300
|
+
- Updated dependencies [7a60f10]
|
|
301
|
+
- Updated dependencies [274b2e5]
|
|
302
|
+
- Updated dependencies [b9e1c54]
|
|
303
|
+
- @modern-js/utils@2.11.0
|
|
304
|
+
- @modern-js/plugin-i18n@2.11.0
|
|
305
|
+
|
|
306
|
+
## 2.10.0
|
|
307
|
+
|
|
308
|
+
### Patch Changes
|
|
309
|
+
|
|
310
|
+
- 0da32d0: chore: upgrade jest and puppeteer
|
|
311
|
+
chore: 升级 jest 和 puppeteer 到 latest
|
|
312
|
+
- Updated dependencies [0da32d0]
|
|
313
|
+
- Updated dependencies [0d9962b]
|
|
314
|
+
- Updated dependencies [fbefa7e]
|
|
315
|
+
- Updated dependencies [4d54233]
|
|
316
|
+
- Updated dependencies [6db4864]
|
|
317
|
+
- @modern-js/plugin-i18n@2.10.0
|
|
318
|
+
- @modern-js/utils@2.10.0
|
|
319
|
+
|
|
320
|
+
## 2.9.0
|
|
321
|
+
|
|
322
|
+
### Patch Changes
|
|
323
|
+
|
|
324
|
+
- @modern-js/plugin-i18n@2.9.0
|
|
325
|
+
- @modern-js/utils@2.9.0
|
|
326
|
+
|
|
327
|
+
## 2.8.0
|
|
328
|
+
|
|
329
|
+
### Patch Changes
|
|
330
|
+
|
|
331
|
+
- Updated dependencies [1104a9f18b]
|
|
332
|
+
- Updated dependencies [1f6ca2c7fb]
|
|
333
|
+
- @modern-js/utils@2.8.0
|
|
334
|
+
- @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.27.1-alpha.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.27.0",
|
|
39
|
+
"@modern-js/utils": "2.27.0"
|
|
43
40
|
},
|
|
44
41
|
"devDependencies": {
|
|
45
42
|
"@types/jest": "^29",
|
|
@@ -47,15 +44,14 @@
|
|
|
47
44
|
"jest": "^29",
|
|
48
45
|
"ts-node": "^10.9.1",
|
|
49
46
|
"typescript": "^5",
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@scripts/
|
|
47
|
+
"@scripts/build": "2.27.0",
|
|
48
|
+
"@modern-js/upgrade-generator": "3.1.29",
|
|
49
|
+
"@scripts/jest-config": "2.27.0"
|
|
53
50
|
},
|
|
54
51
|
"sideEffects": false,
|
|
55
52
|
"publishConfig": {
|
|
56
53
|
"registry": "https://registry.npmjs.org/",
|
|
57
|
-
"access": "public"
|
|
58
|
-
"provenance": true
|
|
54
|
+
"access": "public"
|
|
59
55
|
},
|
|
60
56
|
"scripts": {
|
|
61
57
|
"new": "modern-lib new",
|