Files
luzzle/packages/web/config/scripts/generate-external-schema.js
eleith fd4a421907 [config,web] adopt TypeBox configuration contracts
Replace config's AJV/json2ts pipeline with authored TypeBox schemas, inferred types, and one generated editor schema. Migrate presence-based auth and explicit AI provider/key contracts with their callers. Core retains AJV.

Refs #78
2026-10-05 10:34:12 -07:00

24 lines
694 B
JavaScript

import { readFileSync, writeFileSync } from "node:fs";
import { ConfigSchema } from "../src/lib/config/schema.ts";
import { createInputSchema } from "../src/lib/config/input-schema.ts";
const output = new URL(
"../src/lib/config/web.config.schema.json",
import.meta.url,
);
const schema = {
$schema: "http://json-schema.org/draft-07/schema#",
...createInputSchema(ConfigSchema),
};
const content = JSON.stringify(schema, null, 2) + "\n";
if (process.argv.includes("--check")) {
if (readFileSync(output, "utf8") !== content) {
throw new Error(
"Editor schema is stale. Run pnpm --filter @luzzle/web.config build:external-schema.",
);
}
} else {
writeFileSync(output, content);
}