Files
workinf_Blender_Wasm/tools/web/refresh-wbv2-implementation-hashes.mjs
mes123456 b1ec8d29f6
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
feat(web): bind physics manifests to Blender Main
2026-08-29 11:39:36 +08:00

27 lines
2.8 KiB
JavaScript

import crypto from "node:crypto";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
const ids = ["WBV2-P24-003", "WBV2-P25-000", "WBV2-P25-001", "WBV2-P25-002", "WBV2-P25-003", "WBV2-P25-004", "WBV2-P25-005", "WBV2-P25-006", "WBV2-P25-007", "WBV2-P25-008", "WBV2-P26-000", "WBV2-P26-001", "WBV2-P26-002", "WBV2-P26-003", "WBV2-P26-004", "WBV2-P26-005", "WBV2-P26-006", "WBV2-P27-000", "WBV2-P27-001", "WBV2-P27-002", "WBV2-P28-000", "WBV2-P28-001", "WBV2-P28-002", "WBV2-P28-003", "WBV2-P28-004", "WBV2-P28-005", "WBV2-P29-000", "WBV2-P29-001", "WBV2-P29-002", "WBV2-P29-003", "WBV2-P29-004", "WBV2-P30-000", "WBV2-P30-001", "WBV2-P30-002", "WBV2-P30-003", "WBV2-P30-004", "WBV2-P31-000", "WBV2-P31-001", "WBV2-P31-002", "WBV2-P31-003", "WBV2-P32-000", "WBV2-P32-001", "WBV2-P32-002", "WBV2-P32-003", "WBV2-P33-000", "WBV2-P33-001", "WBV2-P33-002", "WBV2-P33-003", "WBV2-P34-000", "WBV2-P34-001", "WBV2-P34-002", "WBV2-P34-003", "WBV2-P35-000", "WBV2-P35-001", "WBV2-P35-002", "WBV2-P35-003", "WBV2-P36-000", "WBV2-P36-001", "WBV2-P36-002", "WBV2-P36-003", "WBV2-P37-000", "WBV2-P37-001", "WBV2-P37-002", "WBV2-P37-003", "WBV2-P38-000", "WBV2-P38-001", "WBV2-P38-002", "WBV2-P38-003", "WBV2-P39-000", "WBV2-P39-001", "WBV2-P39-002", "WBV2-P39-003", "WBV2-P40-000", "WBV2-P40-001", "WBV2-P40-002", "WBV2-P40-003", "WBV2-P41-000", "WBV2-P41-001", "WBV2-P41-002", "WBV2-P41-003", "WBV2-P42-000", "WBV2-P42-001", "WBV2-P42-002", "WBV2-P42-003", "WBV2-P43-000", "WBV2-P43-001", "WBV2-P43-002", "WBV2-P43-003", "WBV2-P44-000", "WBV2-P44-001", "WBV2-P44-002", "WBV2-P44-003", "WBV2-P45-000", "WBV2-P45-001", "WBV2-P45-002", "WBV2-P45-003", "WBV2-P46-000", "WBV2-P46-001", "WBV2-P46-002", "WBV2-P46-003", "WBV2-P47-000", "WBV2-P47-001", "WBV2-P47-002", "WBV2-P47-003", "WBV2-P48-000", "WBV2-P48-001", "WBV2-P48-002", "WBV2-P48-003", "WBV2-P49-000", "WBV2-P49-001", "WBV2-P49-002", "WBV2-P49-003"];
const abs = (file) => path.join(root, file);
const sha = (file) => crypto.createHash("sha256").update(fs.readFileSync(abs(file))).digest("hex");
for (let pass = 0; pass < ids.length; pass += 1) {
let changed = false;
for (const id of ids) {
const file = `tests/golden/${id}/manifest.json`;
if (!fs.existsSync(abs(file))) continue;
const manifest = JSON.parse(fs.readFileSync(abs(file), "utf8"));
for (const artifact of Object.values(manifest.artifacts ?? {})) {
if (artifact?.path && fs.existsSync(abs(artifact.path))) {
const current = sha(artifact.path);
if (artifact.sha256 !== current) { artifact.sha256 = current; changed = true; }
}
}
fs.writeFileSync(abs(file), `${JSON.stringify(manifest, null, 2)}\n`);
}
if (!changed) break;
}
console.log(`wbv2-implementation-hashes-refreshed tasks=${ids.length}`);