Something went wrong. Try again.
opencode v2 mirror
Something went wrong. Try again.
TypeScript
12345678910111213141516171819import { fileURLToPath } from "url"
const source = fileURLToPath(new URL("../../../packages/protocol/openapi.json", import.meta.url))const targets = ["../openapi.json", "../public/openapi.json"].map((path) => fileURLToPath(new URL(path, import.meta.url)),)const document = await Bun.file(source).text()
if (process.argv.includes("--check")) { const stale = (await Promise.all(targets.map((path) => Bun.file(path).text()))).some((value) => value !== document) if (stale) { console.error("Generated OpenAPI documents are stale. Run `bun run generate` from services/www.") process.exit(1) } process.exit(0)}
await Promise.all(targets.map((path) => Bun.write(path, document)))