@davstack/openapi-react-query-codegen
Version:
OpenAPI React Query Codegen using --useOptions (fork from @7nohe/openapi-react-query-codegen)
28 lines (27 loc) • 1.43 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const generate_1 = require("./generate");
const commander_1 = require("commander");
const package_json_1 = __importDefault(require("../package.json"));
const program = new commander_1.Command();
program
.name('openapi-rq')
.version(package_json_1.default.version)
.description('Generate React Query code based on OpenAPI')
.requiredOption('-i, --input <value>', 'OpenAPI specification, can be a path, url or string content (required)')
.option('-o, --output <value>', 'Output directory', 'openapi')
.option('-c, --client <value>', 'HTTP client to generate [fetch, xhr, node, axios, angular]', 'fetch')
.option('--useUnionTypes', 'Use union types', false)
.option('--exportSchemas <value>', 'Write schemas to disk', false)
.option('--indent <value>', 'Indentation options [4, 2, tabs]', '4')
.option('--postfixServices <value>', 'Service name postfix', 'Service')
.option('--postfixModels <value>', 'Modal name postfix')
.option('--request <value>', 'Path to custom request file')
.parse();
const options = program.opts();
console.log(`Generating React Query code using OpenApi file ${options.output}`);
(0, generate_1.generate)(options);