/** * Regenerator for `schema/config.schema.json`. * * Run via `bun run schema` from the package root. Writes the draft 2020-12 JSON * Schema rendering of `ConfigSchema` (see `config-schema.ts`) to * `schema/config.schema.json`, which ships in the package so editors can * validate a hand-written config. The `config.test.ts` freshness lock fails * when a committed schema drifts from what this script produces. */ import { mkdirSync, writeFileSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { configJsonSchema } from "./config-schema.ts"; const packageDir = join(dirname(fileURLToPath(import.meta.url)), ".."); const schemaDir = join(packageDir, "schema"); mkdirSync(schemaDir, { recursive: true }); const out = join(schemaDir, "config.schema.json"); writeFileSync(out, `${JSON.stringify(configJsonSchema(), null, 2)}\n`); console.log(`wrote ${out}`);