From f26ebc105e140992639864fa01950454abd716ac Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Fri, 26 Mar 2021 17:31:06 +0530 Subject: [PATCH] fix: generation of `negative` flags (#2555) --- packages/webpack-cli/lib/webpack-cli.js | 12 ++++++---- .../__snapshots__/help.test.js.snap.webpack4 | 24 ------------------- .../__snapshots__/help.test.js.snap.webpack5 | 24 ------------------- 3 files changed, 8 insertions(+), 52 deletions(-) diff --git a/packages/webpack-cli/lib/webpack-cli.js b/packages/webpack-cli/lib/webpack-cli.js index 14839a2eb67..23177d515e6 100644 --- a/packages/webpack-cli/lib/webpack-cli.js +++ b/packages/webpack-cli/lib/webpack-cli.js @@ -363,7 +363,8 @@ class WebpackCLI { alias: 'm', configs: [ { - type: 'boolean', + type: 'enum', + values: [true], }, ], description: "Merge two or more configurations using 'webpack-merge'.", @@ -430,7 +431,8 @@ class WebpackCLI { name: 'analyze', configs: [ { - type: 'boolean', + type: 'enum', + values: [true], }, ], multiple: false, @@ -443,7 +445,8 @@ class WebpackCLI { type: 'string', }, { - type: 'boolean', + type: 'enum', + values: [true], }, ], description: 'Print compilation progress during build.', @@ -466,7 +469,8 @@ class WebpackCLI { type: 'string', }, { - type: 'boolean', + type: 'enum', + values: [true], }, ], alias: 'j', diff --git a/test/help/__snapshots__/help.test.js.snap.webpack4 b/test/help/__snapshots__/help.test.js.snap.webpack4 index 852d9ff1ff5..f53799dc9c0 100644 --- a/test/help/__snapshots__/help.test.js.snap.webpack4 +++ b/test/help/__snapshots__/help.test.js.snap.webpack4 @@ -69,13 +69,10 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. --entry The entry point(s) of your application e.g. ./src/main.js. -o, --output-path Output location of the file generated by webpack e.g. ./dist/. -t, --target Sets the build target e.g. node. @@ -125,13 +122,10 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. --entry The entry point(s) of your application e.g. ./src/main.js. -o, --output-path Output location of the file generated by webpack e.g. ./dist/. -t, --target Sets the build target e.g. node. @@ -181,13 +175,10 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. --entry The entry point(s) of your application e.g. ./src/main.js. -o, --output-path Output location of the file generated by webpack e.g. ./dist/. -t, --target Sets the build target e.g. node. @@ -238,14 +229,11 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. --entry The entry point(s) of your application e.g. ./src/main.js. -o, --output-path Output location of the file generated by webpack @@ -413,14 +401,11 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. --entry The entry point(s) of your application e.g. ./src/main.js. -o, --output-path Output location of the file generated by webpack @@ -498,14 +483,11 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. --entry The entry point(s) of your application e.g. ./src/main.js. -o, --output-path Output location of the file generated by webpack @@ -546,13 +528,10 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. --entry The entry point(s) of your application e.g. ./src/main.js. -o, --output-path Output location of the file generated by webpack e.g. ./dist/. -t, --target Sets the build target e.g. node. @@ -602,13 +581,10 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. --entry The entry point(s) of your application e.g. ./src/main.js. -o, --output-path Output location of the file generated by webpack e.g. ./dist/. -t, --target Sets the build target e.g. node. diff --git a/test/help/__snapshots__/help.test.js.snap.webpack5 b/test/help/__snapshots__/help.test.js.snap.webpack5 index fea93d618b3..61e8d1048bc 100644 --- a/test/help/__snapshots__/help.test.js.snap.webpack5 +++ b/test/help/__snapshots__/help.test.js.snap.webpack5 @@ -69,13 +69,10 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. -d, --devtool Determine source maps to use. --no-devtool Do not generate source maps. --entry The entry point(s) of your application e.g. ./src/main.js. @@ -127,13 +124,10 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. -d, --devtool Determine source maps to use. --no-devtool Do not generate source maps. --entry The entry point(s) of your application e.g. ./src/main.js. @@ -185,13 +179,10 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. -d, --devtool Determine source maps to use. --no-devtool Do not generate source maps. --entry The entry point(s) of your application e.g. ./src/main.js. @@ -244,14 +235,11 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. -d, --devtool Determine source maps to use. --no-devtool Do not generate source maps. --entry The entry point(s) of your application e.g. @@ -421,14 +409,11 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. -d, --devtool Determine source maps to use. --no-devtool Do not generate source maps. --entry The entry point(s) of your application e.g. @@ -508,14 +493,11 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. -d, --devtool Determine source maps to use. --no-devtool Do not generate source maps. --entry The entry point(s) of your application e.g. @@ -558,13 +540,10 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. -d, --devtool Determine source maps to use. --no-devtool Do not generate source maps. --entry The entry point(s) of your application e.g. ./src/main.js. @@ -616,13 +595,10 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --no-merge Negative 'merge' option. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. - --no-progress Negative 'progress' option. -j, --json [value] Prints result as JSON or store it in a file. - --no-json Negative 'json' option. -d, --devtool Determine source maps to use. --no-devtool Do not generate source maps. --entry The entry point(s) of your application e.g. ./src/main.js.