@hey-api/openapi-ts
Version:
🌀 OpenAPI to TypeScript code generator. Generate API clients, SDKs, validators, and more.
3 lines • 1.8 kB
JavaScript
const e=require(`./openApi-DV_SToAE.cjs`),t=require(`./src-CnDKH9rV.cjs`);let n=require(`commander`);var r=`0.89.2`,i={"openapi-ts":`./bin/run.js`};const a=e=>e===`true`?!0:e===`false`?!1:e,o=(e,t)=>{for(let n of t){let t=e[n];if(typeof t==`string`){let r=a(t);delete e[n],e[n]=r}}return e},s=async()=>{let e=new n.Command().name(Object.keys(i)[0]).usage(`[options]`).version(r).option(`-c, --client <value>`,`HTTP client to generate`).option(`-d, --debug`,`Set log level to debug`).option(`--dry-run [value]`,`Skip writing files to disk?`).option(`-f, --file [value]`,`Path to the config file`).option(`-i, --input <value>`,`OpenAPI specification (path, url, or string content)`).option(`-l, --logs [value]`,`Logs folder`).option(`-o, --output <value>`,`Output folder`).option(`-p, --plugins [value...]`,`List of plugins you'd like to use`).option(`-s, --silent`,`Set log level to silent`).option(`--no-log-file`,`Disable writing a log file. Works like --silent but without suppressing console output`).option(`-w, --watch [value]`,`Regenerate the client when the input file changes?`).parse(process.argv).opts(),a;try{a=o(e,[`dryRun`,`logFile`]),a.file&&(a.configFile=a.file,delete a.file),e.plugins===!0?a.plugins=[]:e.plugins?a.plugins=e.plugins:a.client&&(a.plugins=[`@hey-api/typescript`,`@hey-api/sdk`]),a.client&&(a.plugins.push(a.client),delete a.client),a.logs=a.logs?{path:a.logs}:{},a.debug?(a.logs.level=`debug`,delete a.debug):a.silent&&(a.logs.level=`silent`,delete a.silent),a.logs.file=a.logFile,delete a.logFile,typeof e.watch==`string`&&(a.watch=Number.parseInt(e.watch,10)),Object.keys(a.logs).length||delete a.logs,(await t.r(a))[0]?.config.input.some(e=>e.watch&&e.watch.enabled)||process.exit(0)}catch{process.exit(1)}};s();
//# sourceMappingURL=run.cjs.map