c926985b63
The previous approach called loadHyperframeRuntimeSource() to regenerate the runtime IIFE, but its output lacked the trailing newline present in the pre-built artifact, causing a SHA256 checksum mismatch with the manifest. Copy the pre-built files from core/dist directly instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
20 lines
1.0 KiB
TypeScript
20 lines
1.0 KiB
TypeScript
import { copyFileSync, readFileSync } from "node:fs";
|
|
import { resolve, dirname } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const coreDistDir = resolve(__dirname, "../../core/dist");
|
|
|
|
// Read the pre-built manifest to find the IIFE artifact name
|
|
const manifest = JSON.parse(readFileSync(resolve(coreDistDir, "hyperframe.manifest.json"), "utf8"));
|
|
const iifeFileName = manifest.artifacts?.iife ?? "hyperframe.runtime.iife.js";
|
|
|
|
// Copy the pre-built artifacts from core/dist — these have matching SHA256
|
|
// checksums. Do NOT regenerate via loadHyperframeRuntimeSource() as that
|
|
// produces output without the trailing newline, causing a checksum mismatch.
|
|
copyFileSync(resolve(coreDistDir, "hyperframe.manifest.json"), "dist/hyperframe.manifest.json");
|
|
copyFileSync(resolve(coreDistDir, iifeFileName), `dist/${iifeFileName}`);
|
|
|
|
// Keep legacy name for backward compat (e.g. studio dev server)
|
|
copyFileSync(resolve(coreDistDir, iifeFileName), "dist/hyperframe-runtime.js");
|