Adapted from #3579 by @gorkem-bwl. The openapi/registry, helpers, and per-resource routes/* files are largely their work; this commit relocates the directory out of src/ so the build-time generator code is not emitted into dist/, and shifts spec generation from runtime to a build step. Co-authored-by: gorkem-bwl <gorkem.cetin@bluewavelabs.ca>
11 lines
421 B
TypeScript
11 lines
421 B
TypeScript
import { writeFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { getOpenApiSpec } from "../openapi/index.js";
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const outPath = path.resolve(__dirname, "..", "openapi.json");
|
|
|
|
writeFileSync(outPath, JSON.stringify(getOpenApiSpec(), null, 2) + "\n");
|
|
console.log(`OpenAPI spec written to ${outPath}`);
|