@lark-apaas/miaoda-cli 0.1.19 → 0.1.20
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.
|
@@ -481,7 +481,6 @@ Examples:
|
|
|
481
481
|
'应用到 online;online 将无法直接更改数据库结构(仍可进行数据 DML 操作)。')
|
|
482
482
|
.usage('[flags]')
|
|
483
483
|
.option('--sync-data', '启用时将现有数据同步一份到 dev 环境')
|
|
484
|
-
.option('-y, --yes', '跳过确认提示直接执行')
|
|
485
484
|
.action(async function () {
|
|
486
485
|
await (0, index_1.handleDbMigrationInit)(this.optsWithGlobals());
|
|
487
486
|
})
|
|
@@ -562,7 +561,6 @@ Examples:
|
|
|
562
561
|
.summary('将 dev 的变更发布到 online(单事务原子)')
|
|
563
562
|
.description('将 dev 的变更发布到 online。')
|
|
564
563
|
.usage('[flags]')
|
|
565
|
-
.option('-y, --yes', '跳过确认提示直接执行')
|
|
566
564
|
.action(async function () {
|
|
567
565
|
await (0, index_1.handleDbMigrationApply)(this.optsWithGlobals());
|
|
568
566
|
})
|
|
@@ -681,7 +679,6 @@ Examples:
|
|
|
681
679
|
.description('将数据库恢复到指定时间点的状态。')
|
|
682
680
|
.usage('<timestamp> [flags]')
|
|
683
681
|
.argument('<timestamp>', '目标时间')
|
|
684
|
-
.option('-y, --yes', '跳过确认提示直接执行')
|
|
685
682
|
.action(async function (target) {
|
|
686
683
|
await (0, index_1.handleDbRecoveryApply)(target, this.optsWithGlobals());
|
|
687
684
|
})
|
|
@@ -146,9 +146,10 @@ Examples:
|
|
|
146
146
|
.usage('[paths...] [flags]')
|
|
147
147
|
.argument('[paths...]', '要删除的文件,每项可填路径或文件名(自动识别)')
|
|
148
148
|
.option('-n, --name <name>', '按文件名删除(可重复指定)', (value, prev) => [...(prev ?? []), value])
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
// --yes 是 root 全局 option(见 main.ts),不在此重复声明;必须经 optsWithGlobals
|
|
150
|
+
// 读取(值挂在 root 上,本地 this.opts().yes 为 undefined),否则非交互场景确认门会误拦。
|
|
151
|
+
.action(async function (paths) {
|
|
152
|
+
await (0, index_1.handleFileRm)(paths, { ...this.optsWithGlobals(), appId: (0, shared_1.resolveAppId)({}) });
|
|
152
153
|
})
|
|
153
154
|
.addHelpText('after', `
|
|
154
155
|
Notes:
|
|
@@ -135,6 +135,32 @@ async function handleAppMigrate(opts) {
|
|
|
135
135
|
installError = err instanceof Error ? err.message : String(err);
|
|
136
136
|
(0, logger_1.log)('migrate', `⚠ npm install failed (continuing): ${installError}`);
|
|
137
137
|
}
|
|
138
|
+
// 重启 dev process 前清 vite cache —— migrate 改了 package.json + lockfile,
|
|
139
|
+
// 老 vite 进程的 .vite/deps cache 的 lockfileHash 跟新 lockfile 不一致。
|
|
140
|
+
// 不清的话 supervisor 拉起的新 vite cold start 会立即 "Re-optimizing because
|
|
141
|
+
// lockfile has changed", re-optimize 期间 ModuleGraph transform cache 跟
|
|
142
|
+
// deps middleware metadata 短暂不同步, 浏览器请求老 hash 触发
|
|
143
|
+
// ERR_OUTDATED_OPTIMIZED_DEP → 504 死锁(详见 fullstack-plugin#1143 的 504
|
|
144
|
+
// ignoreOutdatedRequests fix 注释)。直接 rm -rf 让新 vite 从干净状态 cold
|
|
145
|
+
// optimize, 一次写到位 lockfile 一致的 metadata, 不再触发中途 re-optimize。
|
|
146
|
+
//
|
|
147
|
+
// - 只在 SANDBOX_ID 非空时做(本地一般不会撞这条链路)
|
|
148
|
+
// - 只在 install 成功时做(install 挂了 node_modules 状态不对, 清 cache 也救不回来)
|
|
149
|
+
// - 软失败:.vite 不存在 / 删失败都不阻断
|
|
150
|
+
if (installError === undefined &&
|
|
151
|
+
process.env.SANDBOX_ID !== undefined &&
|
|
152
|
+
process.env.SANDBOX_ID !== '') {
|
|
153
|
+
const viteCacheDir = node_path_1.default.join(targetDir, 'node_modules', '.vite');
|
|
154
|
+
if (node_fs_1.default.existsSync(viteCacheDir)) {
|
|
155
|
+
(0, logger_1.log)('migrate', '清理 node_modules/.vite (vite cache 跟新 lockfile 错位会 504)...');
|
|
156
|
+
try {
|
|
157
|
+
node_fs_1.default.rmSync(viteCacheDir, { recursive: true, force: true });
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
(0, logger_1.log)('migrate', `⚠ 清 .vite 失败 (continuing): ${err instanceof Error ? err.message : String(err)}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
138
164
|
// 沙箱环境下重启 dev process —— scripts/dev.js 被 fullstack 版本覆盖了,但当前正在
|
|
139
165
|
// 跑的 node 进程仍按老逻辑工作(只起 vite,没起 nest),整体没切到 fullstack 模式。
|
|
140
166
|
// 通过 pkill 杀掉 dev.js 主进程,依赖沙箱平台 supervisor 自动重新 exec dev.sh → dev.js,
|
package/dist/main.js
CHANGED
|
@@ -30,6 +30,9 @@ program
|
|
|
30
30
|
.argParser((0, shared_1.caseInsensitiveChoice)(['pretty', 'json']))
|
|
31
31
|
.default('pretty'))
|
|
32
32
|
.option('--verbose', 'debug 日志到 stderr')
|
|
33
|
+
// 全局接受 -y/--yes:作为 root 全局 option 下发到所有子命令解析(同 --json/--verbose),
|
|
34
|
+
// 让任意命令带 --yes 都不报 unknown option。对有确认门的破坏性命令生效,其余命令忽略。
|
|
35
|
+
.option('-y, --yes', '跳过确认提示(对有确认门的命令生效,其余命令忽略)')
|
|
33
36
|
.helpOption('-h, --help', '显示帮助信息')
|
|
34
37
|
.hook('preAction', (_thisCmd, actionCmd) => {
|
|
35
38
|
(0, log_id_1.generateLogId)();
|