From 2273536b75c1d7510ddc2f15734e6c1ee7cf5995 Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Mon, 30 Apr 2018 20:07:19 +0200 Subject: [PATCH] cli(cmds): revise yargs command (#422) * use yargs.command instead of yargs.option for sub-commands * cli(node): Add node flags to CLI (#377) * feat: add support for node flags * tests: Fix node-flags test * misc: Fix test failing due to not-found webpack-cli * misc: remove comment * misc: refactor removing unecessary args * tests: add more tests to prevent argument collision * cli(cmds): remove strict * fix(node): remove node option for now --- bin/config-yargs.js | 50 +-------------------------------------------- bin/webpack.js | 1 + 2 files changed, 2 insertions(+), 49 deletions(-) diff --git a/bin/config-yargs.js b/bin/config-yargs.js index 65abf670e88..9bb0ab75287 100644 --- a/bin/config-yargs.js +++ b/bin/config-yargs.js @@ -6,7 +6,6 @@ const OUTPUT_GROUP = "Output options:"; const ADVANCED_GROUP = "Advanced options:"; const RESOLVE_GROUP = "Resolving options:"; const OPTIMIZE_GROUP = "Optimizing options:"; -const INIT_GROUP = "Initialization:"; module.exports = function(yargs) { yargs @@ -15,52 +14,6 @@ module.exports = function(yargs) { .version() .alias("version", "v") .options({ - init: { - type: "boolean", - describe: - "Initializes a new webpack configuration or loads a" + - "\n" + - "addon if specified", - group: INIT_GROUP - }, - migrate: { - type: "boolean", - describe: - "Migrate your webpack configuration from webpack 1 to webpack 2", - group: INIT_GROUP - }, - add: { - type: "boolean", - describe: "Adds a webpack component to your configuration file", - group: INIT_GROUP - }, - /* - remove: { - type: "boolean", - describe: "Removes a webpack component to your configuration file", - group: INIT_GROUP - }, - update: { - type: "boolean", - describe: "Updates a webpack component to your configuration file", - group: INIT_GROUP - }, - make: { - type: "boolean", - describe: "Converts a webpack configuration to a makefile", - group: INIT_GROUP - }, - */ - "generate-loader": { - type: "boolean", - describe: "Generates a new webpack loader project", - group: INIT_GROUP - }, - "generate-plugin": { - type: "boolean", - describe: "Generates a new webpack plugin project", - group: INIT_GROUP - }, config: { type: "string", describe: "Path to the config file", @@ -365,6 +318,5 @@ module.exports = function(yargs) { "shortcut for --optimize-minimize --define process.env.NODE_ENV=\"production\"", group: BASIC_GROUP } - }) - .strict(); + }); }; diff --git a/bin/webpack.js b/bin/webpack.js index c09cb9ddb94..5564fab59c5 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -53,6 +53,7 @@ Usage: webpack-cli [options] webpack-cli [options] --entry --output webpack-cli [options] --output + webpack-cli [options] For more information, see https://webpack.js.org/api/cli/.`);