// Build-time dump of the standard registry's block metadata to // generated/block-meta.json — the committed artifact downstream tooling // reads without importing levelset at runtime. Run with // `bun run scripts/generate-block-meta.ts`. // // The committed JSON is checked in and kept honest by the drift test in // test/level-blocks/blockMeta.test.ts: if a block's schema, shadow, or the // composition grammar changes, re-run this script and commit the result. import { dumpBlockMeta } from "../src/level-blocks/meta.ts"; import { standardRegistry } from "../src/level-blocks/standard.ts"; const OUTPUT = new URL("../generated/block-meta.json", import.meta.url); const dump = dumpBlockMeta(standardRegistry()); await Bun.write(OUTPUT, JSON.stringify(dump, null, 2) + "\n"); console.log( `Wrote ${String(dump.blocks.length)} block(s) to ${OUTPUT.pathname} (levelset ${dump.levelsetVersion}).`, );