Files
workinf_Blender_Wasm/tools/web/update-engine-manifest.mjs
2026-08-12 04:47:48 -04:00

13 lines
592 B
JavaScript

import fs from "node:fs";
const [manifestPath, wasmHash] = process.argv.slice(2);
if (!manifestPath || !/^[a-f0-9]{64}$/.test(wasmHash ?? "")) {
throw new Error("usage: update-engine-manifest.mjs <manifest.json> <wasm-sha256>");
}
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
const resource = manifest.wasm?.find((entry) => entry.id === "web-engine-bootstrap");
if (!resource) throw new Error("web-engine-bootstrap resource is missing from the engine manifest");
resource.sha256 = wasmHash;
fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);