Something went wrong. Try again.
opencode v2 mirror
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122import { OpenApi } from "effect/unstable/httpapi"import { format } from "prettier"import { fileURLToPath } from "url"import { ClientApi } from "../src/client.js"import { stabilizeOpenApi } from "./openapi-stabilize.js"
const document = await format(JSON.stringify(stabilizeOpenApi(OpenApi.fromApi(ClientApi)), null, 2), { parser: "json", printWidth: 120,})const target = fileURLToPath(new URL("../openapi.json", import.meta.url))
if (process.argv.includes("--check")) { if ((await Bun.file(target).text()) !== document) { console.error("Generated OpenAPI document is stale. Run `bun run generate` from packages/protocol.") process.exit(1) } process.exit(0)}
await Bun.write(target, document)