Skip to content

Commit f26ebc1

Browse files
authored
fix: generation of negative flags (#2555)
1 parent 3d1e485 commit f26ebc1

File tree

3 files changed

+8
-52
lines changed

3 files changed

+8
-52
lines changed

packages/webpack-cli/lib/webpack-cli.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,8 @@ class WebpackCLI {
363363
alias: 'm',
364364
configs: [
365365
{
366-
type: 'boolean',
366+
type: 'enum',
367+
values: [true],
367368
},
368369
],
369370
description: "Merge two or more configurations using 'webpack-merge'.",
@@ -430,7 +431,8 @@ class WebpackCLI {
430431
name: 'analyze',
431432
configs: [
432433
{
433-
type: 'boolean',
434+
type: 'enum',
435+
values: [true],
434436
},
435437
],
436438
multiple: false,
@@ -443,7 +445,8 @@ class WebpackCLI {
443445
type: 'string',
444446
},
445447
{
446-
type: 'boolean',
448+
type: 'enum',
449+
values: [true],
447450
},
448451
],
449452
description: 'Print compilation progress during build.',
@@ -466,7 +469,8 @@ class WebpackCLI {
466469
type: 'string',
467470
},
468471
{
469-
type: 'boolean',
472+
type: 'enum',
473+
values: [true],
470474
},
471475
],
472476
alias: 'j',

test/help/__snapshots__/help.test.js.snap.webpack4

-24
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,10 @@ Options:
6969
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
7070
--config-name <value...> Name of the configuration to use.
7171
-m, --merge Merge two or more configurations using 'webpack-merge'.
72-
--no-merge Negative 'merge' option.
7372
--env <value...> Environment passed to the configuration when it is a function.
7473
--node-env <value> Sets process.env.NODE_ENV to the specified value.
7574
--progress [value] Print compilation progress during build.
76-
--no-progress Negative 'progress' option.
7775
-j, --json [value] Prints result as JSON or store it in a file.
78-
--no-json Negative 'json' option.
7976
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
8077
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
8178
-t, --target <value> Sets the build target e.g. node.
@@ -125,13 +122,10 @@ Options:
125122
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
126123
--config-name <value...> Name of the configuration to use.
127124
-m, --merge Merge two or more configurations using 'webpack-merge'.
128-
--no-merge Negative 'merge' option.
129125
--env <value...> Environment passed to the configuration when it is a function.
130126
--node-env <value> Sets process.env.NODE_ENV to the specified value.
131127
--progress [value] Print compilation progress during build.
132-
--no-progress Negative 'progress' option.
133128
-j, --json [value] Prints result as JSON or store it in a file.
134-
--no-json Negative 'json' option.
135129
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
136130
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
137131
-t, --target <value> Sets the build target e.g. node.
@@ -181,13 +175,10 @@ Options:
181175
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
182176
--config-name <value...> Name of the configuration to use.
183177
-m, --merge Merge two or more configurations using 'webpack-merge'.
184-
--no-merge Negative 'merge' option.
185178
--env <value...> Environment passed to the configuration when it is a function.
186179
--node-env <value> Sets process.env.NODE_ENV to the specified value.
187180
--progress [value] Print compilation progress during build.
188-
--no-progress Negative 'progress' option.
189181
-j, --json [value] Prints result as JSON or store it in a file.
190-
--no-json Negative 'json' option.
191182
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
192183
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
193184
-t, --target <value> Sets the build target e.g. node.
@@ -238,14 +229,11 @@ Options:
238229
--config-name <value...> Name of the configuration to use.
239230
-m, --merge Merge two or more configurations using
240231
'webpack-merge'.
241-
--no-merge Negative 'merge' option.
242232
--env <value...> Environment passed to the configuration when it is
243233
a function.
244234
--node-env <value> Sets process.env.NODE_ENV to the specified value.
245235
--progress [value] Print compilation progress during build.
246-
--no-progress Negative 'progress' option.
247236
-j, --json [value] Prints result as JSON or store it in a file.
248-
--no-json Negative 'json' option.
249237
--entry <value...> The entry point(s) of your application e.g.
250238
./src/main.js.
251239
-o, --output-path <value> Output location of the file generated by webpack
@@ -413,14 +401,11 @@ Options:
413401
--config-name <value...> Name of the configuration to use.
414402
-m, --merge Merge two or more configurations using
415403
'webpack-merge'.
416-
--no-merge Negative 'merge' option.
417404
--env <value...> Environment passed to the configuration when it
418405
is a function.
419406
--node-env <value> Sets process.env.NODE_ENV to the specified value.
420407
--progress [value] Print compilation progress during build.
421-
--no-progress Negative 'progress' option.
422408
-j, --json [value] Prints result as JSON or store it in a file.
423-
--no-json Negative 'json' option.
424409
--entry <value...> The entry point(s) of your application e.g.
425410
./src/main.js.
426411
-o, --output-path <value> Output location of the file generated by webpack
@@ -498,14 +483,11 @@ Options:
498483
--config-name <value...> Name of the configuration to use.
499484
-m, --merge Merge two or more configurations using
500485
'webpack-merge'.
501-
--no-merge Negative 'merge' option.
502486
--env <value...> Environment passed to the configuration when it is
503487
a function.
504488
--node-env <value> Sets process.env.NODE_ENV to the specified value.
505489
--progress [value] Print compilation progress during build.
506-
--no-progress Negative 'progress' option.
507490
-j, --json [value] Prints result as JSON or store it in a file.
508-
--no-json Negative 'json' option.
509491
--entry <value...> The entry point(s) of your application e.g.
510492
./src/main.js.
511493
-o, --output-path <value> Output location of the file generated by webpack
@@ -546,13 +528,10 @@ Options:
546528
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
547529
--config-name <value...> Name of the configuration to use.
548530
-m, --merge Merge two or more configurations using 'webpack-merge'.
549-
--no-merge Negative 'merge' option.
550531
--env <value...> Environment passed to the configuration when it is a function.
551532
--node-env <value> Sets process.env.NODE_ENV to the specified value.
552533
--progress [value] Print compilation progress during build.
553-
--no-progress Negative 'progress' option.
554534
-j, --json [value] Prints result as JSON or store it in a file.
555-
--no-json Negative 'json' option.
556535
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
557536
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
558537
-t, --target <value> Sets the build target e.g. node.
@@ -602,13 +581,10 @@ Options:
602581
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
603582
--config-name <value...> Name of the configuration to use.
604583
-m, --merge Merge two or more configurations using 'webpack-merge'.
605-
--no-merge Negative 'merge' option.
606584
--env <value...> Environment passed to the configuration when it is a function.
607585
--node-env <value> Sets process.env.NODE_ENV to the specified value.
608586
--progress [value] Print compilation progress during build.
609-
--no-progress Negative 'progress' option.
610587
-j, --json [value] Prints result as JSON or store it in a file.
611-
--no-json Negative 'json' option.
612588
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
613589
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
614590
-t, --target <value> Sets the build target e.g. node.

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

-24
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,10 @@ Options:
6969
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
7070
--config-name <value...> Name of the configuration to use.
7171
-m, --merge Merge two or more configurations using 'webpack-merge'.
72-
--no-merge Negative 'merge' option.
7372
--env <value...> Environment passed to the configuration when it is a function.
7473
--node-env <value> Sets process.env.NODE_ENV to the specified value.
7574
--progress [value] Print compilation progress during build.
76-
--no-progress Negative 'progress' option.
7775
-j, --json [value] Prints result as JSON or store it in a file.
78-
--no-json Negative 'json' option.
7976
-d, --devtool <value> Determine source maps to use.
8077
--no-devtool Do not generate source maps.
8178
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
@@ -127,13 +124,10 @@ Options:
127124
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
128125
--config-name <value...> Name of the configuration to use.
129126
-m, --merge Merge two or more configurations using 'webpack-merge'.
130-
--no-merge Negative 'merge' option.
131127
--env <value...> Environment passed to the configuration when it is a function.
132128
--node-env <value> Sets process.env.NODE_ENV to the specified value.
133129
--progress [value] Print compilation progress during build.
134-
--no-progress Negative 'progress' option.
135130
-j, --json [value] Prints result as JSON or store it in a file.
136-
--no-json Negative 'json' option.
137131
-d, --devtool <value> Determine source maps to use.
138132
--no-devtool Do not generate source maps.
139133
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
@@ -185,13 +179,10 @@ Options:
185179
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
186180
--config-name <value...> Name of the configuration to use.
187181
-m, --merge Merge two or more configurations using 'webpack-merge'.
188-
--no-merge Negative 'merge' option.
189182
--env <value...> Environment passed to the configuration when it is a function.
190183
--node-env <value> Sets process.env.NODE_ENV to the specified value.
191184
--progress [value] Print compilation progress during build.
192-
--no-progress Negative 'progress' option.
193185
-j, --json [value] Prints result as JSON or store it in a file.
194-
--no-json Negative 'json' option.
195186
-d, --devtool <value> Determine source maps to use.
196187
--no-devtool Do not generate source maps.
197188
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
@@ -244,14 +235,11 @@ Options:
244235
--config-name <value...> Name of the configuration to use.
245236
-m, --merge Merge two or more configurations using
246237
'webpack-merge'.
247-
--no-merge Negative 'merge' option.
248238
--env <value...> Environment passed to the configuration when it is
249239
a function.
250240
--node-env <value> Sets process.env.NODE_ENV to the specified value.
251241
--progress [value] Print compilation progress during build.
252-
--no-progress Negative 'progress' option.
253242
-j, --json [value] Prints result as JSON or store it in a file.
254-
--no-json Negative 'json' option.
255243
-d, --devtool <value> Determine source maps to use.
256244
--no-devtool Do not generate source maps.
257245
--entry <value...> The entry point(s) of your application e.g.
@@ -421,14 +409,11 @@ Options:
421409
--config-name <value...> Name of the configuration to use.
422410
-m, --merge Merge two or more configurations using
423411
'webpack-merge'.
424-
--no-merge Negative 'merge' option.
425412
--env <value...> Environment passed to the configuration when it
426413
is a function.
427414
--node-env <value> Sets process.env.NODE_ENV to the specified value.
428415
--progress [value] Print compilation progress during build.
429-
--no-progress Negative 'progress' option.
430416
-j, --json [value] Prints result as JSON or store it in a file.
431-
--no-json Negative 'json' option.
432417
-d, --devtool <value> Determine source maps to use.
433418
--no-devtool Do not generate source maps.
434419
--entry <value...> The entry point(s) of your application e.g.
@@ -508,14 +493,11 @@ Options:
508493
--config-name <value...> Name of the configuration to use.
509494
-m, --merge Merge two or more configurations using
510495
'webpack-merge'.
511-
--no-merge Negative 'merge' option.
512496
--env <value...> Environment passed to the configuration when it is
513497
a function.
514498
--node-env <value> Sets process.env.NODE_ENV to the specified value.
515499
--progress [value] Print compilation progress during build.
516-
--no-progress Negative 'progress' option.
517500
-j, --json [value] Prints result as JSON or store it in a file.
518-
--no-json Negative 'json' option.
519501
-d, --devtool <value> Determine source maps to use.
520502
--no-devtool Do not generate source maps.
521503
--entry <value...> The entry point(s) of your application e.g.
@@ -558,13 +540,10 @@ Options:
558540
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
559541
--config-name <value...> Name of the configuration to use.
560542
-m, --merge Merge two or more configurations using 'webpack-merge'.
561-
--no-merge Negative 'merge' option.
562543
--env <value...> Environment passed to the configuration when it is a function.
563544
--node-env <value> Sets process.env.NODE_ENV to the specified value.
564545
--progress [value] Print compilation progress during build.
565-
--no-progress Negative 'progress' option.
566546
-j, --json [value] Prints result as JSON or store it in a file.
567-
--no-json Negative 'json' option.
568547
-d, --devtool <value> Determine source maps to use.
569548
--no-devtool Do not generate source maps.
570549
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
@@ -616,13 +595,10 @@ Options:
616595
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
617596
--config-name <value...> Name of the configuration to use.
618597
-m, --merge Merge two or more configurations using 'webpack-merge'.
619-
--no-merge Negative 'merge' option.
620598
--env <value...> Environment passed to the configuration when it is a function.
621599
--node-env <value> Sets process.env.NODE_ENV to the specified value.
622600
--progress [value] Print compilation progress during build.
623-
--no-progress Negative 'progress' option.
624601
-j, --json [value] Prints result as JSON or store it in a file.
625-
--no-json Negative 'json' option.
626602
-d, --devtool <value> Determine source maps to use.
627603
--no-devtool Do not generate source maps.
628604
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.

0 commit comments

Comments
 (0)