test: 增加发布包运行时预检

This commit is contained in:
que01 committed 2026-10-20 21:24:21 +08:00
1 parent 16fd827634
commit ea81c754ed
3 files changed
+63 -2

No files matched your search

+4
View File
@@ -6,6 +6,7 @@ import { fileURLToPath } from "node:url";
import { spawnSync } from "node:child_process";
import { createRequire } from "node:module";
import { checkPackage } from "./check-package.mjs";
import { verifyRuntimePreflight } from "./runtime-preflight.mjs";
const require = createRequire(import.meta.url);
const { findLeaks, loadConfig } = require("../../apps/taro/config/mask-taro.cjs");
@@ -173,6 +174,8 @@ async function buildTemplateCatalog() {
}
async function main() {
if (Number(process.versions.node.split(".")[0]) !== 24)
throw new Error("Node.js 24 is required to build the release");
if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$/.test(version))
throw new Error("Invalid release version");
const adminDist = path.join(root, "apps/admin/dist");
@@ -245,6 +248,7 @@ async function main() {
}
await writeFile(path.join(output, "manifest.json"), JSON.stringify(manifest, null, 2) + "\n");
await checkPackage(output);
await verifyRuntimePreflight(output);
run("tar", ["-czf", archive, "-C", output, "."]);
const checksum = createHash("sha256")
.update(await readFile(archive))