Files
pbakaus_impeccable/scripts/build-component-review.mjs
T
Paul Bakaus 6a7e931f7e Pin Bun for reproducible embedded review bundles
CI used a newer minifier than the local release build. Keep the byte-for-byte drift check and use one explicit build toolchain across local regeneration and CI.

AI assistance: OpenAI Codex.
2026-09-13 20:48:00 -07:00

11 lines
878 B
JavaScript

// Source bundle embedded in the native engine; no Node/Bun is needed at runtime.
import { fileURLToPath } from 'node:url';
import { resolve } from 'node:path';
import { readFileSync } from 'node:fs';
const root = fileURLToPath(new URL('../', import.meta.url));
const pinnedBun = readFileSync(resolve(root, '.bun-version'), 'utf8').trim();
if (Bun.version !== pinnedBun) throw new Error(`Component review bundles require Bun ${pinnedBun}; received ${Bun.version}. Use the pinned toolchain before regenerating tracked output.`);
const result = await Bun.build({ entrypoints: [resolve(root, 'ui/component-review/entry.ts')], target: 'browser', format: 'iife', minify: true });
if (!result.success) throw new AggregateError(result.logs, 'Component review bundle failed');
await Bun.write(resolve(root, 'crates/context/assets/component-review.js'), await result.outputs[0].text());