mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 22:32:28 +00:00
Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Liang-Shih Lin <liangshihlin@proton.me> Co-authored-by: Dominik Engelhardt <dominikengelhardt@ymail.com> Co-authored-by: Jay V <air@live.ca> Co-authored-by: adamdottv <2363879+adamdottv@users.noreply.github.com>
16 lines
507 B
TypeScript
16 lines
507 B
TypeScript
import { Server } from "../../server/server"
|
|
import fs from "fs/promises"
|
|
import path from "path"
|
|
import type { CommandModule } from "yargs"
|
|
|
|
export const GenerateCommand = {
|
|
command: "generate",
|
|
handler: async () => {
|
|
const specs = await Server.openapi()
|
|
const dir = "gen"
|
|
await fs.rmdir(dir, { recursive: true }).catch(() => {})
|
|
await fs.mkdir(dir, { recursive: true })
|
|
await Bun.write(path.join(dir, "openapi.json"), JSON.stringify(specs, null, 2))
|
|
},
|
|
} satisfies CommandModule
|