UNPKG

typed-openapi

Version:
26 lines (24 loc) 1.01 kB
import { generateClientFiles } from "./chunk-RGFFCU3R.js"; import { allowedRuntimes } from "./chunk-N6BWPZUB.js"; // src/cli.ts import { cac } from "cac"; import { readFileSync } from "fs"; var { name, version } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")); var cli = cac(name); cli.command("<input>", "Generate").option("-o, --output <path>", "Output path for the api client ts file (defaults to `<input>.<runtime>.ts`)").option( "-r, --runtime <name>", `Runtime to use for validation; defaults to \`none\`; available: ${allowedRuntimes.toString()}`, { default: "none" } ).option("--schemas-only", "Only generate schemas, skipping client generation (defaults to false)", { default: false }).option( "--tanstack [name]", "Generate tanstack client, defaults to false, can optionally specify a name for the generated file" ).action(async (input, _options) => { return generateClientFiles(input, _options); }); cli.help(); cli.version(version); cli.parse();