@hey-api/openapi-ts
Version:
🌀 OpenAPI to TypeScript code generator. Generate API clients, SDKs, validators, and more.
3 lines • 1.8 kB
JavaScript
import"./openApi-Dz9FsU_q.mjs";import{r as e}from"./src-novPNOHw.mjs";import{Command as t}from"commander";var n=`0.89.2`,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 i=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(),o;try{o=a(i,[`dryRun`,`logFile`]),o.file&&(o.configFile=o.file,delete o.file),i.plugins===!0?o.plugins=[]:i.plugins?o.plugins=i.plugins:o.client&&(o.plugins=[`@hey-api/typescript`,`@hey-api/sdk`]),o.client&&(o.plugins.push(o.client),delete o.client),o.logs=o.logs?{path:o.logs}:{},o.debug?(o.logs.level=`debug`,delete o.debug):o.silent&&(o.logs.level=`silent`,delete o.silent),o.logs.file=o.logFile,delete o.logFile,typeof i.watch==`string`&&(o.watch=Number.parseInt(i.watch,10)),Object.keys(o.logs).length||delete o.logs,(await e(o))[0]?.config.input.some(e=>e.watch&&e.watch.enabled)||process.exit(0)}catch{process.exit(1)}})();export{};
//# sourceMappingURL=run.mjs.map