Skip to content

Commit 35843e8

Browse files
snitin315alexander-akait
authored andcommittedNov 15, 2022
fix: show all CLI specific flags in the minimum help output (#3354)
1 parent 60b3020 commit 35843e8

File tree

2 files changed

+59
-20
lines changed

2 files changed

+59
-20
lines changed
 

‎packages/webpack-cli/src/webpack-cli.ts

+13-20
Original file line numberDiff line numberDiff line change
@@ -698,26 +698,6 @@ class WebpackCLI implements IWebpackCLI {
698698
return this.builtInOptionsCache;
699699
}
700700

701-
const minimumHelpFlags = [
702-
"config",
703-
"config-name",
704-
"merge",
705-
"disable-interpret",
706-
"env",
707-
"mode",
708-
"watch",
709-
"watch-options-stdin",
710-
"stats",
711-
"devtool",
712-
"entry",
713-
"target",
714-
"progress",
715-
"json",
716-
"name",
717-
"output-path",
718-
"node-env",
719-
];
720-
721701
const builtInFlags: WebpackCLIBuiltInFlag[] = [
722702
// For configs
723703
{
@@ -873,6 +853,19 @@ class WebpackCLI implements IWebpackCLI {
873853
},
874854
];
875855

856+
const minimumHelpFlags = [
857+
...builtInFlags.map((flag) => flag.name),
858+
"mode",
859+
"watch",
860+
"watch-options-stdin",
861+
"stats",
862+
"devtool",
863+
"entry",
864+
"target",
865+
"name",
866+
"output-path",
867+
];
868+
876869
// Extract all the flags being exported from core.
877870
// 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
878871
const coreArguments = Object.entries(this.webpack.cli.getArguments()).map(([flag, meta]) => {

‎test/help/__snapshots__/help.test.js.snap.devServer4.webpack5

+46
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ Options:
100100
--disable-interpret Disable interpret a config file.
101101
--env <value...> Environment passed to the configuration when it is a function.
102102
--node-env <value> Sets process.env.NODE_ENV to the specified value.
103+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
103104
--progress [value] Print compilation progress during build.
104105
-j, --json [value] Prints result as JSON or store it in a file.
106+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
105107
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
106108
--no-devtool Negative 'devtool' option.
107109
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -157,8 +159,10 @@ Options:
157159
--disable-interpret Disable interpret a config file.
158160
--env <value...> Environment passed to the configuration when it is a function.
159161
--node-env <value> Sets process.env.NODE_ENV to the specified value.
162+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
160163
--progress [value] Print compilation progress during build.
161164
-j, --json [value] Prints result as JSON or store it in a file.
165+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
162166
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
163167
--no-devtool Negative 'devtool' option.
164168
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -214,8 +218,10 @@ Options:
214218
--disable-interpret Disable interpret a config file.
215219
--env <value...> Environment passed to the configuration when it is a function.
216220
--node-env <value> Sets process.env.NODE_ENV to the specified value.
221+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
217222
--progress [value] Print compilation progress during build.
218223
-j, --json [value] Prints result as JSON or store it in a file.
224+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
219225
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
220226
--no-devtool Negative 'devtool' option.
221227
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -270,8 +276,10 @@ Options:
270276
--disable-interpret Disable interpret a config file.
271277
--env <value...> Environment passed to the configuration when it is a function.
272278
--node-env <value> Sets process.env.NODE_ENV to the specified value.
279+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
273280
--progress [value] Print compilation progress during build.
274281
-j, --json [value] Prints result as JSON or store it in a file.
282+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
275283
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
276284
--no-devtool Negative 'devtool' option.
277285
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -314,8 +322,10 @@ Options:
314322
--disable-interpret Disable interpret a config file.
315323
--env <value...> Environment passed to the configuration when it is a function.
316324
--node-env <value> Sets process.env.NODE_ENV to the specified value.
325+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
317326
--progress [value] Print compilation progress during build.
318327
-j, --json [value] Prints result as JSON or store it in a file.
328+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
319329
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
320330
--no-devtool Negative 'devtool' option.
321331
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -361,8 +371,12 @@ Options:
361371
--env <value...> Environment passed to the configuration when it is
362372
a function.
363373
--node-env <value> Sets process.env.NODE_ENV to the specified value.
374+
--analyze It invokes webpack-bundle-analyzer plugin to get
375+
bundle information.
364376
--progress [value] Print compilation progress during build.
365377
-j, --json [value] Prints result as JSON or store it in a file.
378+
--fail-on-warnings Stop webpack-cli process with non-zero exit code
379+
on warnings from webpack
366380
-d, --devtool <value> A developer tool to enhance debugging (false |
367381
eval |
368382
[inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
@@ -418,8 +432,12 @@ Options:
418432
--env <value...> Environment passed to the configuration when it is
419433
a function.
420434
--node-env <value> Sets process.env.NODE_ENV to the specified value.
435+
--analyze It invokes webpack-bundle-analyzer plugin to get
436+
bundle information.
421437
--progress [value] Print compilation progress during build.
422438
-j, --json [value] Prints result as JSON or store it in a file.
439+
--fail-on-warnings Stop webpack-cli process with non-zero exit code
440+
on warnings from webpack
423441
-d, --devtool <value> A developer tool to enhance debugging (false |
424442
eval |
425443
[inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
@@ -472,8 +490,10 @@ Options:
472490
--disable-interpret Disable interpret a config file.
473491
--env <value...> Environment passed to the configuration when it is a function.
474492
--node-env <value> Sets process.env.NODE_ENV to the specified value.
493+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
475494
--progress [value] Print compilation progress during build.
476495
-j, --json [value] Prints result as JSON or store it in a file.
496+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
477497
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
478498
--no-devtool Negative 'devtool' option.
479499
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -516,8 +536,10 @@ Options:
516536
--disable-interpret Disable interpret a config file.
517537
--env <value...> Environment passed to the configuration when it is a function.
518538
--node-env <value> Sets process.env.NODE_ENV to the specified value.
539+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
519540
--progress [value] Print compilation progress during build.
520541
-j, --json [value] Prints result as JSON or store it in a file.
542+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
521543
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
522544
--no-devtool Negative 'devtool' option.
523545
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -1494,8 +1516,10 @@ Options:
14941516
--disable-interpret Disable interpret a config file.
14951517
--env <value...> Environment passed to the configuration when it is a function.
14961518
--node-env <value> Sets process.env.NODE_ENV to the specified value.
1519+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
14971520
--progress [value] Print compilation progress during build.
14981521
-j, --json [value] Prints result as JSON or store it in a file.
1522+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
14991523
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
15001524
--no-devtool Negative 'devtool' option.
15011525
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -1536,8 +1560,10 @@ Options:
15361560
--disable-interpret Disable interpret a config file.
15371561
--env <value...> Environment passed to the configuration when it is a function.
15381562
--node-env <value> Sets process.env.NODE_ENV to the specified value.
1563+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
15391564
--progress [value] Print compilation progress during build.
15401565
-j, --json [value] Prints result as JSON or store it in a file.
1566+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
15411567
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
15421568
--no-devtool Negative 'devtool' option.
15431569
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -1581,8 +1607,12 @@ Options:
15811607
--env <value...> Environment passed to the configuration when it is
15821608
a function.
15831609
--node-env <value> Sets process.env.NODE_ENV to the specified value.
1610+
--analyze It invokes webpack-bundle-analyzer plugin to get
1611+
bundle information.
15841612
--progress [value] Print compilation progress during build.
15851613
-j, --json [value] Prints result as JSON or store it in a file.
1614+
--fail-on-warnings Stop webpack-cli process with non-zero exit code
1615+
on warnings from webpack
15861616
-d, --devtool <value> A developer tool to enhance debugging (false |
15871617
eval |
15881618
[inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
@@ -1636,8 +1666,12 @@ Options:
16361666
--env <value...> Environment passed to the configuration when it is
16371667
a function.
16381668
--node-env <value> Sets process.env.NODE_ENV to the specified value.
1669+
--analyze It invokes webpack-bundle-analyzer plugin to get
1670+
bundle information.
16391671
--progress [value] Print compilation progress during build.
16401672
-j, --json [value] Prints result as JSON or store it in a file.
1673+
--fail-on-warnings Stop webpack-cli process with non-zero exit code
1674+
on warnings from webpack
16411675
-d, --devtool <value> A developer tool to enhance debugging (false |
16421676
eval |
16431677
[inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
@@ -1688,8 +1722,10 @@ Options:
16881722
--disable-interpret Disable interpret a config file.
16891723
--env <value...> Environment passed to the configuration when it is a function.
16901724
--node-env <value> Sets process.env.NODE_ENV to the specified value.
1725+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
16911726
--progress [value] Print compilation progress during build.
16921727
-j, --json [value] Prints result as JSON or store it in a file.
1728+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
16931729
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
16941730
--no-devtool Negative 'devtool' option.
16951731
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -1730,8 +1766,10 @@ Options:
17301766
--disable-interpret Disable interpret a config file.
17311767
--env <value...> Environment passed to the configuration when it is a function.
17321768
--node-env <value> Sets process.env.NODE_ENV to the specified value.
1769+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
17331770
--progress [value] Print compilation progress during build.
17341771
-j, --json [value] Prints result as JSON or store it in a file.
1772+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
17351773
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
17361774
--no-devtool Negative 'devtool' option.
17371775
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -1773,8 +1811,10 @@ Options:
17731811
--disable-interpret Disable interpret a config file.
17741812
--env <value...> Environment passed to the configuration when it is a function.
17751813
--node-env <value> Sets process.env.NODE_ENV to the specified value.
1814+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
17761815
--progress [value] Print compilation progress during build.
17771816
-j, --json [value] Prints result as JSON or store it in a file.
1817+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
17781818
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
17791819
--no-devtool Negative 'devtool' option.
17801820
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -1830,8 +1870,10 @@ Options:
18301870
--disable-interpret Disable interpret a config file.
18311871
--env <value...> Environment passed to the configuration when it is a function.
18321872
--node-env <value> Sets process.env.NODE_ENV to the specified value.
1873+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
18331874
--progress [value] Print compilation progress during build.
18341875
-j, --json [value] Prints result as JSON or store it in a file.
1876+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
18351877
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
18361878
--no-devtool Negative 'devtool' option.
18371879
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -2077,8 +2119,10 @@ Options:
20772119
--disable-interpret Disable interpret a config file.
20782120
--env <value...> Environment passed to the configuration when it is a function.
20792121
--node-env <value> Sets process.env.NODE_ENV to the specified value.
2122+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
20802123
--progress [value] Print compilation progress during build.
20812124
-j, --json [value] Prints result as JSON or store it in a file.
2125+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
20822126
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
20832127
--no-devtool Negative 'devtool' option.
20842128
--entry <value...> A module that is loaded upon startup. Only the last one is exported.
@@ -2132,8 +2176,10 @@ Options:
21322176
--disable-interpret Disable interpret a config file.
21332177
--env <value...> Environment passed to the configuration when it is a function.
21342178
--node-env <value> Sets process.env.NODE_ENV to the specified value.
2179+
--analyze It invokes webpack-bundle-analyzer plugin to get bundle information.
21352180
--progress [value] Print compilation progress during build.
21362181
-j, --json [value] Prints result as JSON or store it in a file.
2182+
--fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack
21372183
-d, --devtool <value> A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
21382184
--no-devtool Negative 'devtool' option.
21392185
--entry <value...> A module that is loaded upon startup. Only the last one is exported.

0 commit comments

Comments
 (0)
Please sign in to comment.