feat(console): CHV production-grade frontend — worker availability, attachment guard, queue hint, build:console fix, vitest
This commit is contained in:
1 parent
036323e620
commit
003ea357f9
13 files changed
+474
-55
No files matched your search
@@ -1,17 +1,23 @@
|
||||
// build:console 的第二步:把 vite-plugin-singlefile 产出的单文件
|
||||
// 原样拷到可部署位置。绝不改动产物内容——以后改页面只改 src 再构建。
|
||||
// 在本施工目录,目标是 ../console-redesign/console-react.html(主 agent
|
||||
// 审阅用);进仓库后,主 agent 把同一文件拷到 cloud/console.html。
|
||||
import { copyFileSync, statSync } from "node:fs";
|
||||
import { createHash } from "node:crypto";
|
||||
// 目标就是 GET /console 现读的文件 cloud/console.html
|
||||
// (cloud/server.py 与 console.html 同目录、每次请求现读),
|
||||
// 不再拷到仓库里不存在的 cloud/console-redesign/console-react.html,
|
||||
// 也不再靠手工拷兜底:npm run build:console 一次跑通即产物就位。
|
||||
import { copyFileSync } from "node:fs";
|
||||
import { createHash, timingSafeEqual } from "node:crypto";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const src = join(root, "dist", "index.html");
|
||||
const dest = join(root, "..", "console-redesign", "console-react.html");
|
||||
const dest = join(root, "..", "console.html");
|
||||
copyFileSync(src, dest);
|
||||
const buf = readFileSync(dest);
|
||||
console.log(`console-react.html ${buf.length} bytes sha256=${createHash("sha256").update(buf).digest("hex")}`);
|
||||
const srcBuf = readFileSync(src);
|
||||
const destBuf = readFileSync(dest);
|
||||
if (srcBuf.length !== destBuf.length || !timingSafeEqual(srcBuf, destBuf)) {
|
||||
throw new Error("copy-build: dest 与 dist/index.html 内容不一致,构建失败");
|
||||
}
|
||||
console.log(`console.html ${destBuf.length} bytes sha256=${createHash("sha256").update(destBuf).digest("hex")}`);
|
||||
console.log(`built: ${src} -> ${dest}`);
|
||||
Reference in new issue
Block a user