Files
workinf_Blender_Wasm/tools/web/incremental-web-build.mjs
mes123456 ed347098b4
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
perf(web): skip unchanged incremental web builds
2026-09-06 10:46:53 +08:00

24 lines
988 B
JavaScript

import { spawnSync } from "node:child_process";
import fs from "node:fs";
import { fingerprint, readState, root, writeState } from "./web-build-fingerprint.mjs";
const currentFingerprint = fingerprint();
const state = readState("web-build-success.json");
const index = `${root}/web/dist/index.html`;
if (state?.fingerprint === currentFingerprint && fs.existsSync(index)) {
process.stdout.write(`web-build-reused fingerprint=${currentFingerprint}\n`);
process.exit(0);
}
const typecheck = spawnSync(process.execPath, ["tools/web/run-incremental-typecheck.mjs"], {
cwd: root,
stdio: "inherit",
});
if (typecheck.status !== 0) process.exit(typecheck.status ?? 1);
const vite = spawnSync(process.execPath, ["./node_modules/vite/bin/vite.js", "build", "--config", "app/vite.config.ts"], {
cwd: `${root}/web`,
stdio: "inherit",
});
if (vite.status !== 0) process.exit(vite.status ?? 1);
writeState("web-build-success.json", { schemaVersion: 1, fingerprint: currentFingerprint });