chore: various CLI fixes

This commit is contained in:
Roman Hotsiy 2018-03-14 08:24:45 +02:00
parent 5dc21af281
commit e5458c0564
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
5 changed files with 17 additions and 3 deletions

1
.gitignore vendored
View File

@ -25,6 +25,7 @@ stats.json
e2e/.build/ e2e/.build/
cypress/ cypress/
bundles bundles
bin/cli.js
/benchmark/revisions /benchmark/revisions

View File

@ -1,4 +1,4 @@
!bundles/ !bundles/
!package.json !package.json
!README.md !README.md
!bin/ !bin/cli.js

View File

@ -45,6 +45,9 @@ yargs
alias: 'watch', alias: 'watch',
type: 'boolean', type: 'boolean',
}); });
yargs.demandOption('spec');
return yargs;
}, },
async argv => { async argv => {
try { try {
@ -74,6 +77,9 @@ yargs
type: 'boolean', type: 'boolean',
default: false, default: false,
}); });
yargs.demandOption('spec');
return yargs;
}, },
async argv => { async argv => {
try { try {
@ -82,7 +88,8 @@ yargs
console.log(e.message); console.log(e.message);
} }
}, },
).argv; )
.demandCommand().argv;
async function serve(port: number, pathToSpec: string, options: Options = {}) { async function serve(port: number, pathToSpec: string, options: Options = {}) {
let spec = await loadAndBundleSpec(pathToSpec); let spec = await loadAndBundleSpec(pathToSpec);

View File

@ -21,7 +21,8 @@
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
"lint": "tslint --project tsconfig.json", "lint": "tslint --project tsconfig.json",
"benchmark": "node ./benchmark/benchmark.js", "benchmark": "node ./benchmark/benchmark.js",
"start:demo": "webpack-dev-server --config demo/webpack.config.ts" "start:demo": "webpack-dev-server --config demo/webpack.config.ts",
"compile:cli": "tsc bin/cli.ts --target es6 --module commonjs --types yargs"
}, },
"author": "", "author": "",
"license": "MIT", "license": "MIT",
@ -42,6 +43,7 @@
"@types/react-tabs": "^1.0.2", "@types/react-tabs": "^1.0.2",
"@types/webpack": "^3.0.5", "@types/webpack": "^3.0.5",
"@types/webpack-env": "^1.13.0", "@types/webpack-env": "^1.13.0",
"@types/yargs": "^11.0.0",
"awesome-typescript-loader": "^3.2.2", "awesome-typescript-loader": "^3.2.2",
"beautify-benchmark": "^0.2.4", "beautify-benchmark": "^0.2.4",
"conventional-changelog-cli": "^1.3.5", "conventional-changelog-cli": "^1.3.5",

View File

@ -211,6 +211,10 @@
"@types/uglify-js" "*" "@types/uglify-js" "*"
source-map "^0.6.0" source-map "^0.6.0"
"@types/yargs@^11.0.0":
version "11.0.0"
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-11.0.0.tgz#124b9ed9c65b7091cc36da59ae12cbd47d8745ea"
JSONStream@^1.0.4: JSONStream@^1.0.4:
version "1.3.2" version "1.3.2"
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.2.tgz#c102371b6ec3a7cf3b847ca00c20bb0fce4c6dea" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.2.tgz#c102371b6ec3a7cf3b847ca00c20bb0fce4c6dea"