59735c5e38
Replace opaque props with checked generic presentation contracts and lazy typed interface references. Generate readonly/writable field APIs and component checks. Preserve CRDT editing through explicit resolved getter/setter contracts, binding- fenced delta RPCs, native watches and replica-aware field adapters. Custom setters retain semantic writes; storage snapshots never grant write authority. Cover concurrent edits, lost acknowledgements, readonly contracts and authorization. Add receiver-free static factory dispatch, state-field binding shorthand, and conformance-based creation. Migrate TODO, editable scaffolds and authoring guides. Verify language/codegen, SDK, RPC, browser lifecycle, local scaffolds, production browser bundling and CRDT persistence with temporary PostgreSQL.
28 lines
1.2 KiB
JavaScript
28 lines
1.2 KiB
JavaScript
#!/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";
|
|
import { generateReactBindings } from "./react.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 config = options ? JSON.parse(await readFile(options, "utf8")) : {};
|
|
const contracts = JSON.parse(await readFile(schema, "utf8"));
|
|
const generated = generateTypeScriptBindings(contracts, revision, config);
|
|
await writeFile(output, generated);
|
|
if (config.react) {
|
|
await writeFile(path.join(path.dirname(output), "web-studio-react-runtime.d.ts"), reactPlatformTypes);
|
|
await writeFile(
|
|
path.join(path.dirname(output), "react-props.gen.ts"),
|
|
generateReactBindings(contracts, revision, config.react.propsExports, config.react.components),
|
|
);
|
|
}
|
|
};
|
|
main().catch((error: unknown) => {
|
|
console.error(error instanceof Error ? error.message : error);
|
|
process.exitCode = 1;
|
|
});
|