diff --git a/.gitignore b/.gitignore index d35477d0..93632811 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ stats.json e2e/.build/ cypress/ bundles +bin/cli.js /benchmark/revisions diff --git a/.npmignore b/.npmignore index 4475fa4b..6400333e 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,4 @@ !bundles/ !package.json !README.md -!bin/ \ No newline at end of file +!bin/cli.js \ No newline at end of file diff --git a/bin/cli.ts b/bin/cli.ts index 8d089164..d6f0ad62 100644 --- a/bin/cli.ts +++ b/bin/cli.ts @@ -45,6 +45,9 @@ yargs alias: 'watch', type: 'boolean', }); + + yargs.demandOption('spec'); + return yargs; }, async argv => { try { @@ -74,6 +77,9 @@ yargs type: 'boolean', default: false, }); + + yargs.demandOption('spec'); + return yargs; }, async argv => { try { @@ -82,7 +88,8 @@ yargs console.log(e.message); } }, - ).argv; + ) + .demandCommand().argv; async function serve(port: number, pathToSpec: string, options: Options = {}) { let spec = await loadAndBundleSpec(pathToSpec); diff --git a/package.json b/package.json index bf008ef5..580bea7f 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1", "lint": "tslint --project tsconfig.json", "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": "", "license": "MIT", @@ -42,6 +43,7 @@ "@types/react-tabs": "^1.0.2", "@types/webpack": "^3.0.5", "@types/webpack-env": "^1.13.0", + "@types/yargs": "^11.0.0", "awesome-typescript-loader": "^3.2.2", "beautify-benchmark": "^0.2.4", "conventional-changelog-cli": "^1.3.5", diff --git a/yarn.lock b/yarn.lock index fda8c6e3..92b10c79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -211,6 +211,10 @@ "@types/uglify-js" "*" 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: version "1.3.2" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.2.tgz#c102371b6ec3a7cf3b847ca00c20bb0fce4c6dea"