P2-2 二次修复: report release --cells JSON 预校验 (2026-07-02)

第一次 commit 漏了 release.ts (用 releaseType 不是 type)
补 release.ts: step 2 type 校验后, opts.cells try JSON.parse 预校验
This commit is contained in:
ssw committed 2026-07-02 12:35:57 +08:00
1 parent 71874b4f96
commit 40674cc3ce
1 file changed
+10
+10
View File
@@ -97,6 +97,16 @@ export function buildReportReleaseCommand(): Command {
log.error('提示: --type=0 (仅保存设计) 不强制 cells, 但仍建议提供')
process.exit(1)
}
// v0.15+ (P2-2): --cells JSON 预校验, 防止双重 stringify 导致设计器反序列化失败
if (opts.cells) {
try {
JSON.parse(opts.cells)
} catch (e) {
log.error(`--cells 不是合法 JSON 字符串: ${(e as Error).message?.slice(0, 100)}`)
log.error('提示: 后端 ReportCrForm.cells 是 String, 期望前端传 JSON.stringify 后的结果')
process.exit(1)
}
}
// === step 3: 构造 saveVersion body (镜像 web 端 Form.vue handleSubmit) ===
// 后端 ReportUpForm 要求几乎所有字段都在, 跟 update 一样先 getReportInfo 拿全字段,