From d6f8cff6fbf3f3cbfee1021f619309bf2e230430 Mon Sep 17 00:00:00 2001 From: Ferdi Koomen Date: Thu, 16 Jul 2020 00:33:22 +0200 Subject: [PATCH] - Fixed #282 --- .eslintrc.json | 1 + bin/index.js | 26 +++++++++++++------------- package.json | 8 ++++---- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 0dfd4556..b9e6b963 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,6 +17,7 @@ "@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/no-inferrable-types": 0, "@typescript-eslint/no-non-null-assertion": 0, + "@typescript-eslint/no-var-requires": 0, "@typescript-eslint/ban-ts-ignore": 0, "@typescript-eslint/ban-ts-comment": 0, "@typescript-eslint/explicit-function-return-type": 0, diff --git a/bin/index.js b/bin/index.js index 91a089bc..aa2cfbed 100755 --- a/bin/index.js +++ b/bin/index.js @@ -8,15 +8,15 @@ const pkg = require('../package.json'); program .version(pkg.version) - .option('--input [value]', 'Path to swagger specification', './spec.json') - .option('--output [value]', 'Output directory', './generated') - .option('--client [value]', 'HTTP client to generate [fetch, xhr]', 'fetch') - .option('--useOptions', 'Use options vs arguments style functions', false) - .option('--useUnionTypes', 'Use inclusive union types', false) - .option('--exportCore', 'Generate core', true) - .option('--exportServices', 'Generate services', true) - .option('--exportModels', 'Generate models', true) - .option('--exportSchemas', 'Generate schemas', false) + .option('-i, --input ', 'Path to swagger specification', './spec.json') + .option('-o, --output ', 'Output directory', './generated') + .option('-c, --client ', 'HTTP client to generate [fetch, xhr]', 'fetch') + .option('--useOptions', 'Use options vs arguments style functions') + .option('--useUnionTypes', 'Use inclusive union types') + .option('--exportCore ', 'Generate core', true) + .option('--exportServices ', 'Generate services', true) + .option('--exportModels ', 'Generate models', true) + .option('--exportSchemas ', 'Generate schemas', false) .parse(process.argv); const OpenAPI = require(path.resolve(__dirname, '../dist/index.js')); @@ -28,10 +28,10 @@ if (OpenAPI) { httpClient: program.client, useOptions: program.useOptions, useUnionTypes: program.useUnionTypes, - exportCore: program.exportCore, - exportServices: program.exportServices, - exportModels: program.exportModels, - exportSchemas: program.exportSchemas, + exportCore: JSON.parse(program.exportCore) === true, + exportServices: JSON.parse(program.exportServices) === true, + exportModels: JSON.parse(program.exportModels) === true, + exportSchemas: JSON.parse(program.exportSchemas) === true, }) .then(() => { process.exit(0); diff --git a/package.json b/package.json index 17993f3e..5d26592f 100644 --- a/package.json +++ b/package.json @@ -50,10 +50,10 @@ "test:update": "jest --updateSnapshot", "test:watch": "jest --watch", "test:coverage": "jest --coverage", - "eslint": "eslint \"./src/**/*.ts\"", - "eslint:fix": "eslint \"./src/**/*.ts\" --fix", - "prettier": "prettier \"./src/**/*.ts\" --check", - "prettier:fix": "prettier \"./src/**/*.ts\" --write", + "eslint": "eslint \"./src/**/*.ts\" \"./bin/index.js\"", + "eslint:fix": "eslint \"./src/**/*.ts\" \"./bin/index.js\" --fix", + "prettier": "prettier \"./src/**/*.ts\" \"./bin/index.js\" --check", + "prettier:fix": "prettier \"./src/**/*.ts\" \"./bin/index.js\" --write", "codecov": "codecov --token=66c30c23-8954-4892-bef9-fbaed0a2e42b" }, "dependencies": {