Files
hyperframes/packages/cli/scripts/build-runtime.ts
T
JamesandClaude Opus 4.6 68f86f66ac fix(cli): ship runtime manifest alongside CLI bundle
The hyperframeRuntimeLoader uses import.meta.url to resolve
hyperframe.manifest.json as a sibling file. When bundled into the CLI
via tsup, import.meta.url points to dist/cli.js, so the sibling lookup
checks dist/hyperframe.manifest.json — which wasn't being shipped.

Copy the manifest and the canonical-named runtime IIFE into dist/ during
the build-runtime step so the loader's sibling-path resolution works in
published npm packages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 21:02:36 +00:00

17 lines
817 B
TypeScript

import { loadHyperframeRuntimeSource } from "@hyperframes/core";
import { copyFileSync, writeFileSync } 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");
// Write runtime source (keep legacy name for backward compat)
const runtimeSource = loadHyperframeRuntimeSource();
writeFileSync("dist/hyperframe-runtime.js", runtimeSource);
// Copy manifest + runtime with canonical names so hyperframeRuntimeLoader's
// sibling-path resolution works in the bundled CLI (installed via npx).
copyFileSync(resolve(coreDistDir, "hyperframe.manifest.json"), "dist/hyperframe.manifest.json");
writeFileSync("dist/hyperframe.runtime.iife.js", runtimeSource);