@lark-apaas/miaoda-cli 0.1.21-alpha.0 → 0.1.21
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.
|
@@ -161,34 +161,6 @@ async function handleAppMigrate(opts) {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
// 预热 vite deps cache (清 .vite 之后, pkill 之前) —— 把 standalone optimize
|
|
165
|
-
// 提前在干净状态下跑一次, 写出 _metadata.json + 当前 lockfileHash。下一步 pkill
|
|
166
|
-
// 让 supervisor 重启 dev:client, vite 启动检测到 metadata.lockfileHash 跟当前
|
|
167
|
-
// lockfile 一致, 跳过 Re-optimize, 也就跳过了 incremental optimization 中
|
|
168
|
-
// transform cache 跟 deps middleware metadata 短暂不同步那个窗口(详见
|
|
169
|
-
// fullstack-plugin#1152 的 504 fix 讨论)。
|
|
170
|
-
//
|
|
171
|
-
// 顺序约束:必须在清 .vite 之后(否则 prewarm 写的 metadata 会被清掉, 白干)
|
|
172
|
-
// 也必须在 pkill 之前(否则 supervisor 拉起的 vite 已经 cold start, prewarm
|
|
173
|
-
// 没机会赶在它前面写 metadata)。
|
|
174
|
-
//
|
|
175
|
-
// - 只在 SANDBOX_ID 非空时做(本地环境 vite 自带 optimizer 不卡, 没必要拖慢 migrate)
|
|
176
|
-
// - 只在 install 成功时做(install 失败时 node_modules 状态不对, optimize 也会挂)
|
|
177
|
-
// - 软失败:optimize 挂了不阻断后续 pkill —— 即使没预热成功, supervisor 起的
|
|
178
|
-
// vite 自己跑 optimizer 大多数场景能通过, 不要因为这一步丢掉重启 dev 的机会
|
|
179
|
-
if (installError === undefined && (0, env_1.isSandboxEnv)()) {
|
|
180
|
-
(0, logger_1.log)('migrate', 'Pre-warming vite deps cache (vite optimize --force)...');
|
|
181
|
-
try {
|
|
182
|
-
(0, node_child_process_1.execFileSync)('npx', ['-y', 'vite', 'optimize', '--force'], {
|
|
183
|
-
cwd: targetDir,
|
|
184
|
-
stdio: (0, output_1.isJsonMode)() ? ['ignore', 'ignore', 'inherit'] : 'inherit',
|
|
185
|
-
timeout: 120_000,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
catch (err) {
|
|
189
|
-
(0, logger_1.log)('migrate', `⚠ vite optimize prewarm failed (continuing): ${err instanceof Error ? err.message : String(err)}`);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
164
|
// 沙箱环境下重启 dev process —— scripts/dev.js 被 fullstack 版本覆盖了,但当前正在
|
|
193
165
|
// 跑的 node 进程仍按老逻辑工作(只起 vite,没起 nest),整体没切到 fullstack 模式。
|
|
194
166
|
// 通过 pkill 杀掉 dev.js 主进程,依赖沙箱平台 supervisor 自动重新 exec dev.sh → dev.js,
|
|
@@ -70,6 +70,11 @@ exports.MIGRATE_CONFIG = {
|
|
|
70
70
|
// ESLint 9 flat config —— vite-react 用 eslint.config.mjs 已删,fullstack 用
|
|
71
71
|
// eslint.config.js (commonjs) + extends @lark-apaas/fullstack-presets;user 通常不改
|
|
72
72
|
{ type: 'file', from: 'eslint.config.js', to: 'eslint.config.js', overwrite: true },
|
|
73
|
+
// stylelint 配置 —— package.json 加了 `stylelint` script(下面 add-script 那条)
|
|
74
|
+
// + npm run precommit 会调它,缺配置文件时报 `No configuration provided for
|
|
75
|
+
// client/src/index.css`。fullstack template 的 .stylelintrc.js extends
|
|
76
|
+
// @lark-apaas/fullstack-presets 的 stylelintPresetsOfSimple。
|
|
77
|
+
{ type: 'file', from: '.stylelintrc.js', to: '.stylelintrc.js', overwrite: true },
|
|
73
78
|
// client/index.html:HBS 模板(fullstack 用,vite-react 用根 index.html 已删)
|
|
74
79
|
{ type: 'file', from: 'client/index.html', to: 'client/index.html', overwrite: true },
|
|
75
80
|
// scripts/ 整目录:fullstack 形态启动 / 构建 / lint 所需的 8 个平台脚本(dev.sh /
|
|
@@ -274,6 +279,10 @@ exports.MIGRATE_CONFIG = {
|
|
|
274
279
|
// (@lark-apaas/fullstack-presets/lib/simple/tsconfig/tsconfig.node.json);
|
|
275
280
|
// 不装会导致 nest build / type:check:server / vite dev 解析 tsconfig 时 ENOENT
|
|
276
281
|
'@lark-apaas/fullstack-presets',
|
|
282
|
+
// stylelint —— scripts.stylelint + npm run precommit 会调它,
|
|
283
|
+
// 缺依赖时 CI / 本地 precommit 报 "stylelint: command not found"。
|
|
284
|
+
// 配套的 .stylelintrc.js 由上面 file rule 从 template 搬过来。
|
|
285
|
+
'stylelint',
|
|
277
286
|
],
|
|
278
287
|
},
|
|
279
288
|
// ===== 7. 业务代码 codemod:lite → client-toolkit 包名替换 =====
|