@hey-api/openapi-ts
Version:
🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.
3 lines • 1.82 kB
JavaScript
import"./openApi-DXfWYPpF.js";import{r as e}from"./src-CTUbY-zd.js";import{Command as t}from"commander";var n=`0.87.0`,r={"openapi-ts":`./bin/run.js`};const i=e=>e===`true`?!0:e===`false`?!1:e,a=(e,t)=>{for(let n of t){let t=e[n];if(typeof t==`string`){let r=i(t);delete e[n],e[n]=r}}return e};(async()=>{let o=new t().name(Object.keys(r)[0]).usage(`[options]`).version(n).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(),s;try{s=a(o,[`dryRun`,`logFile`]),s.file&&(s.configFile=s.file,delete s.file),o.plugins===!0?s.plugins=[]:o.plugins?s.plugins=o.plugins:s.client&&(s.plugins=[`@hey-api/typescript`,`@hey-api/sdk`]),s.client&&(s.plugins.push(s.client),delete s.client),s.logs=s.logs?{path:s.logs}:{},s.debug||i(process.env.DEBUG)?(s.logs.level=`debug`,delete s.debug):s.silent&&(s.logs.level=`silent`,delete s.silent),s.logs.file=s.logFile,delete s.logFile,typeof o.watch==`string`&&(s.watch=Number.parseInt(o.watch,10)),Object.keys(s.logs).length||delete s.logs,(await e(s))[0]?.config.input.some(e=>e.watch&&e.watch.enabled)||process.exit(0)}catch{process.exit(1)}})();export{};
//# sourceMappingURL=run.js.map