Skip to content

Commit 1490af0

Browse files
snitin315alexander-akait
authored andcommitted
chore: update commander.js to v12 (#4315)
1 parent 71b440d commit 1490af0

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed

packages/webpack-cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@webpack-cli/info": "^2.0.2",
4040
"@webpack-cli/serve": "^2.0.5",
4141
"colorette": "^2.0.14",
42-
"commander": "^10.0.1",
42+
"commander": "^12.1.0",
4343
"cross-spawn": "^7.0.3",
4444
"envinfo": "^7.14.0",
4545
"fastest-levenshtein": "^1.0.12",

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,8 @@ class WebpackCLI implements IWebpackCLI {
16691669
process.exit(0);
16701670
};
16711671
this.program.helpOption(false);
1672-
this.program.addHelpCommand(false);
1672+
// Suppress the default help command
1673+
this.program.helpCommand(false);
16731674
this.program.option("-h, --help [verbose]", "Display help for commands and options.");
16741675

16751676
let isInternalActionCalled = false;

test/api/CLI.test.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1703,11 +1703,9 @@ describe("CLI API", () => {
17031703
consoleSpy = jest.spyOn(global.console, "log");
17041704
exitSpy = jest.spyOn(process, "exit").mockImplementation(() => {});
17051705

1706-
cli.program.option("--color [value]", "any color", "blue");
1707-
17081706
await new Promise((resolve, reject) => {
17091707
try {
1710-
cli.run(["help", "--color"], { from: "user" });
1708+
cli.run(["help", "--mode"], { from: "user" });
17111709
resolve();
17121710
} catch (error) {
17131711
reject(error);

test/api/__snapshots__/CLI.test.js.snap.webpack5

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
exports[`CLI API custom help output should display help information 1`] = `
44
[
55
[
6-
"Usage: webpack --color [value]",
6+
"Usage: webpack --mode <value>",
77
],
88
[
9-
"Description: any color",
9+
"Description: Enable production optimizations or development hints.",
1010
],
1111
[
12-
"Default value: "blue"",
12+
"Possible values: "development | production | none"",
1313
],
1414
[
1515
"",
@@ -19,13 +19,13 @@ exports[`CLI API custom help output should display help information 1`] = `
1919
",
2020
],
2121
[
22-
"Webpack documentation: https://webpack.js.org/.",
22+
"Webpack documentation: https://webpack.js.org/.",
2323
],
2424
[
25-
"CLI documentation: https://webpack.js.org/api/cli/.",
25+
"CLI documentation: https://webpack.js.org/api/cli/.",
2626
],
2727
[
28-
"Made with ♥ by the webpack team.",
28+
"Made with ♥ by the webpack team.",
2929
],
3030
]
3131
`;

yarn.lock

-5
Original file line numberDiff line numberDiff line change
@@ -4142,11 +4142,6 @@ combined-stream@^1.0.8:
41424142
dependencies:
41434143
delayed-stream "~1.0.0"
41444144

4145-
commander@^10.0.1:
4146-
version "10.0.1"
4147-
resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06"
4148-
integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==
4149-
41504145
commander@^12.1.0, commander@~12.1.0:
41514146
version "12.1.0"
41524147
resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3"

0 commit comments

Comments
 (0)