Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/webpack-cli/src/webpack-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ interface CommandOption {
negatedDescription?: string;
defaultValue?: string;
hidden?: boolean;
negativeHidden?: boolean;
group?: "core";
}

Expand Down Expand Up @@ -831,7 +832,7 @@ class WebpackCLI {
false,
);

optionForCommand.hidden = option.hidden || false;
optionForCommand.hidden = option.hidden || option.negativeHidden || false;

command.addOption(optionForCommand);
}
Expand Down Expand Up @@ -1010,8 +1011,10 @@ class WebpackCLI {
},
];

// Options from webpack core to be included in the minimum help output
const minimumHelpFlags = [
// 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/main/test/__snapshots__/Cli.basictest.js.snap
// Fast search, `includes` is slow
const minHelpSet = new Set([
"mode",
"watch",
"watch-options-stdin",
Expand All @@ -1022,12 +1025,8 @@ class WebpackCLI {
"name",
"output-path",
"extends",
];

// 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/main/test/__snapshots__/Cli.basictest.js.snap
// Fast search, `includes` is slow
const minHelpSet = new Set(minimumHelpFlags);
]);
const minimumNegativeHelpFlags = new Set(["devtool"]);
const coreArgs = this.webpack.cli.getArguments();
// Take memory
const options: CommandOption[] = Array.from({
Expand All @@ -1047,6 +1046,7 @@ class WebpackCLI {
description: meta.description,
group: "core",
hidden: !minHelpSet.has(name),
negativeHidden: !minimumNegativeHelpFlags.has(name),
};
}

Expand Down
Loading