From 36a59d8e120e496448ff00bd0b2be47d1d87d226 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Fri, 29 Jul 2022 17:04:16 +0530 Subject: [PATCH] fix: show all CLI specific flags in the minimum help output (#3354) --- packages/webpack-cli/src/webpack-cli.ts | 33 ++++++------- .../help.test.js.snap.devServer4.webpack5 | 46 +++++++++++++++++++ 2 files changed, 59 insertions(+), 20 deletions(-) diff --git a/packages/webpack-cli/src/webpack-cli.ts b/packages/webpack-cli/src/webpack-cli.ts index 9e73001fabb..670de623964 100644 --- a/packages/webpack-cli/src/webpack-cli.ts +++ b/packages/webpack-cli/src/webpack-cli.ts @@ -698,26 +698,6 @@ class WebpackCLI implements IWebpackCLI { return this.builtInOptionsCache; } - const minimumHelpFlags = [ - "config", - "config-name", - "merge", - "disable-interpret", - "env", - "mode", - "watch", - "watch-options-stdin", - "stats", - "devtool", - "entry", - "target", - "progress", - "json", - "name", - "output-path", - "node-env", - ]; - const builtInFlags: WebpackCLIBuiltInFlag[] = [ // For configs { @@ -873,6 +853,19 @@ class WebpackCLI implements IWebpackCLI { }, ]; + const minimumHelpFlags = [ + ...builtInFlags.map((flag) => flag.name), + "mode", + "watch", + "watch-options-stdin", + "stats", + "devtool", + "entry", + "target", + "name", + "output-path", + ]; + // Extract all the flags being exported from core. // A list of cli flags generated by core can be found here https://github.com/webpack/webpack/blob/master/test/__snapshots__/Cli.test.js.snap const coreArguments = Object.entries(this.webpack.cli.getArguments()).map(([flag, meta]) => { diff --git a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack5 b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack5 index 306b6f459b6..8c93e46a642 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack5 +++ b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack5 @@ -100,8 +100,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -157,8 +159,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -214,8 +218,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -270,8 +276,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -314,8 +322,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -361,8 +371,12 @@ Options: --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get + bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code + on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). @@ -418,8 +432,12 @@ Options: --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get + bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code + on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). @@ -472,8 +490,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -516,8 +536,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -1494,8 +1516,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -1536,8 +1560,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -1581,8 +1607,12 @@ Options: --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get + bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code + on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). @@ -1636,8 +1666,12 @@ Options: --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get + bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code + on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). @@ -1688,8 +1722,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -1730,8 +1766,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -1773,8 +1811,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -1830,8 +1870,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -2077,8 +2119,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported. @@ -2132,8 +2176,10 @@ Options: --disable-interpret Disable interpret a config file. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). --no-devtool Negative 'devtool' option. --entry A module that is loaded upon startup. Only the last one is exported.