Provide typed React live-field authoring, strict CLI arguments, and timed build stages

This commit is contained in:
Timothy J. Aveni
2026-09-14 23:38:07 -07:00
parent a84c985256
commit 53708ac06f
6 changed files with 84 additions and 4 deletions
+7 -2
View File
@@ -1,13 +1,18 @@
#!/usr/bin/env node
import { readFile, writeFile } from "node:fs/promises";
import { generateTypeScriptBindings } from "./index.js";
import path from "node:path";
import {reactPlatformTypes} from "./react-platform.js";
const main = async () => {
const [schema, revision, output, options, ...rest] = process.argv.slice(2);
if (!schema || !revision || !output || rest.length) throw new Error(
"usage: quixos-codegen-ts SCHEMA.json PACKAGE_REVISION OUTPUT.ts [OPTIONS.json]");
const generated = generateTypeScriptBindings(JSON.parse(await readFile(schema, "utf8")), revision,
options ? JSON.parse(await readFile(options, "utf8")) : {});
const config = options ? JSON.parse(await readFile(options, "utf8")) : {};
const generated = generateTypeScriptBindings(JSON.parse(await readFile(schema, "utf8")), revision, config);
await writeFile(output, generated);
if (config.messages?.["org.quixos.web-studio.ReactProps"]) {
await writeFile(path.join(path.dirname(output), "web-studio-react-runtime.d.ts"), reactPlatformTypes);
}
};
main().catch((error: unknown) => { console.error(error instanceof Error ? error.message : error); process.exitCode = 1; });