From 07ba568a79d93422e433f2a6e17593451c94e802 Mon Sep 17 00:00:00 2001 From: stefan binoj Date: Mon, 9 Mar 2026 19:52:32 +0530 Subject: [PATCH 1/7] refactor: format cli for better ui --- packages/webpack-cli/src/webpack-cli.ts | 119 ++- .../help.test.js.snap.devServer5.webpack5 | 938 ++++++++++++++++-- test/help/help.test.js | 42 + test/help/set-columns-120.js | 4 + test/help/set-columns-80.js | 4 + 5 files changed, 1019 insertions(+), 88 deletions(-) create mode 100644 test/help/set-columns-120.js create mode 100644 test/help/set-columns-80.js diff --git a/packages/webpack-cli/src/webpack-cli.ts b/packages/webpack-cli/src/webpack-cli.ts index cf0f172159b..cf7a4ac36f9 100644 --- a/packages/webpack-cli/src/webpack-cli.ts +++ b/packages/webpack-cli/src/webpack-cli.ts @@ -2,7 +2,7 @@ import fs from "node:fs"; import path from "node:path"; import { type Readable as ReadableType } from "node:stream"; import { pathToFileURL } from "node:url"; -import util from "node:util"; +import util, { stripVTControlCharacters } from "node:util"; import { type stringifyChunked as stringifyChunkedType } from "@discoveryjs/json-ext"; import { type Argument, @@ -100,6 +100,7 @@ type CommanderArgs = Record; type BasicPrimitive = string | boolean | number; type EnumValue = string | number | boolean | EnumValueObject | EnumValue[] | null; +type HelpColorFormatter = "dim" | "underline" | "yellow" | "bold"; interface EnumValueObject { [key: string]: EnumValue; @@ -1211,23 +1212,95 @@ class WebpackCLI { ); }, formatHelp: (command, helper: Help) => { - const formatItem = (term: string, description: string) => { + const renderText = (formatterName: HelpColorFormatter, value: string): string => { + const formatter = this.colors[formatterName]; + return typeof formatter === "function" ? formatter(value) : value; + }; + + const underlineText = (value: string) => + this.colors.isColorSupported ? `\u001B[4m${value}\u001B[24m` : value; + + const columns = process.stdout.columns || 80; + const centerBannerLine = (value: string) => { + const visibleWidth = stripVTControlCharacters(value).length; + const leftPadding = Math.max(0, Math.floor((columns - visibleWidth) / 2)); + + return `${" ".repeat(leftPadding)}${value}`; + }; + const formatTabularItem = (term: string, description: string, padWidth: number) => { + const formattedTerm = isGlobalHelp ? bold(term) : term; + if (description) { - return helper.formatItem(term, helper.padWidth(command, helper), description, helper); + return helper.formatItem(formattedTerm, padWidth, description, helper); } - return term; + return formattedTerm; }; const formatList = (textArray: string[]) => textArray.join("\n").replaceAll(/^/gm, ""); + const formatSection = (title: string, textArray: string[]) => { + if (textArray.length === 0) { + return ""; + } - // Usage - let output = [`${bold("Usage:")} ${helper.commandUsage(command)}`, ""]; + return ["", underlineText(bold(title)), "", formatList(textArray), "", ""]; + }; + const padWidth = helper.padWidth(command, helper); + + let output: string[] = []; + + const bannerTitleText = `${renderText("dim", "○")} ${renderText( + "underline", + renderText("dim", "webpack"), + )} ${renderText("dim", "○")}`; + const bannerTitle = centerBannerLine(bannerTitleText); + const bannerLinkText = renderText( + "underline", + renderText("dim", "https://webpack.js.org"), + ); + const bannerLink = centerBannerLine(bannerLinkText); + const descriptionLine = centerBannerLine("The build tool for modern web applications"); + const usageLine = `${renderText("bold", "Usage:")} ${renderText( + "yellow", + "`webpack [...options] | `", + )}`; + const exampleLine = `${renderText("bold", "Example:")} ${renderText( + "yellow", + "`webpack help --flag | `", + )}`; + + output = isGlobalHelp + ? [ + "", + bannerTitle, + "", + bannerLink, + "", + descriptionLine, + "", + centerBannerLine(usageLine), + "", + centerBannerLine(exampleLine), + "", + "", + ] + : [ + "", + bannerTitle, + "", + bannerLink, + "", + descriptionLine, + "", + centerBannerLine(usageLine), + "", + centerBannerLine(exampleLine), + "", + "", + ]; // Description - const commandDescription = isGlobalHelp - ? "The build tool for modern web applications." - : helper.commandDescription(command); + const commandDescription = isGlobalHelp ? "" : helper.commandDescription(command); if (commandDescription.length > 0) { output = [...output, commandDescription, ""]; @@ -1236,41 +1309,53 @@ class WebpackCLI { // Arguments const argumentList = helper .visibleArguments(command) - .map((argument) => formatItem(argument.name(), argument.description)); + .map((argument) => formatTabularItem(argument.name(), argument.description, padWidth)); if (argumentList.length > 0) { - output = [...output, bold("Arguments:"), formatList(argumentList), ""]; + output = [...output, ...formatSection("Arguments:", argumentList)]; } // Options const optionList = helper .visibleOptions(command) .map((option) => - formatItem(helper.optionTerm(option), helper.optionDescription(option)), + formatTabularItem( + helper.optionTerm(option), + helper.optionDescription(option), + padWidth, + ), ); if (optionList.length > 0) { - output = [...output, bold("Options:"), formatList(optionList), ""]; + output = [...output, ...formatSection("Options:", optionList)]; } // Global options const globalOptionList = program.options.map((option) => - formatItem(helper.optionTerm(option), helper.optionDescription(option)), + formatTabularItem( + helper.optionTerm(option), + helper.optionDescription(option), + padWidth, + ), ); if (globalOptionList.length > 0) { - output = [...output, bold("Global options:"), formatList(globalOptionList), ""]; + output = [...output, ...formatSection("Global options:", globalOptionList)]; } // Commands const commandList = helper .visibleCommands(isGlobalHelp ? program : command) .map((command) => - formatItem(helper.subcommandTerm(command), helper.subcommandDescription(command)), + formatTabularItem( + helper.subcommandTerm(command), + helper.subcommandDescription(command), + padWidth, + ), ); if (commandList.length > 0) { - output = [...output, bold("Commands:"), formatList(commandList), ""]; + output = [...output, ...formatSection("Commands:", commandList)]; } return output.join("\n"); diff --git a/test/help/__snapshots__/help.test.js.snap.devServer5.webpack5 b/test/help/__snapshots__/help.test.js.snap.devServer5.webpack5 index 9b5adec60c9..2703202a6d6 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer5.webpack5 +++ b/test/help/__snapshots__/help.test.js.snap.devServer5.webpack5 @@ -88,12 +88,21 @@ exports[`help should log error for unknown option using command syntax #4: stdou exports[`help should show help information and respect the "--color" flag using the "--help" option: stderr 1`] = `""`; exports[`help should show help information and respect the "--color" flag using the "--help" option: stdout 1`] = ` -"Usage: webpack [entries...] [options] -Alternative usage to run commands: webpack [command] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + -The build tool for modern web applications. Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -116,13 +125,19 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + + Commands: + build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). configtest|t [config-path] Validate a webpack configuration. help|h [command] [option] Display help for commands and options. @@ -131,6 +146,7 @@ Commands: version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. watch|w [entries...] [options] Run webpack and watch for files changes. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -141,12 +157,21 @@ Made with ♥ by the webpack team." exports[`help should show help information and respect the "--no-color" flag using the "--help" option: stderr 1`] = `""`; exports[`help should show help information and respect the "--no-color" flag using the "--help" option: stdout 1`] = ` -"Usage: webpack [entries...] [options] -Alternative usage to run commands: webpack [command] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + -The build tool for modern web applications. Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -169,13 +194,19 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + + Commands: + build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). configtest|t [config-path] Validate a webpack configuration. help|h [command] [option] Display help for commands and options. @@ -184,6 +215,7 @@ Commands: version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. watch|w [entries...] [options] Run webpack and watch for files changes. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -194,12 +226,21 @@ Made with ♥ by the webpack team." exports[`help should show help information and taking precedence when "--help" and "--version" option using together: stderr 1`] = `""`; exports[`help should show help information and taking precedence when "--help" and "--version" option using together: stdout 1`] = ` -"Usage: webpack [entries...] [options] -Alternative usage to run commands: webpack [command] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + -The build tool for modern web applications. Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -222,13 +263,19 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + + Commands: + build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). configtest|t [config-path] Validate a webpack configuration. help|h [command] [option] Display help for commands and options. @@ -237,6 +284,7 @@ Commands: version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. watch|w [entries...] [options] Run webpack and watch for files changes. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -247,11 +295,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'b' command using command syntax: stderr 1`] = `""`; exports[`help should show help information for 'b' command using command syntax: stdout 1`] = ` -"Usage: webpack build|bundle|b [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack (default command, can be omitted). + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -274,12 +334,16 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -290,11 +354,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'b' command using the "--help verbose" option: stderr 1`] = `""`; exports[`help should show help information for 'b' command using the "--help verbose" option: stdout 1`] = ` -"Usage: webpack build|bundle|b [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack (default command, can be omitted). + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -319,12 +395,16 @@ Options: --watch-options-stdin Stop watching when stdin stream has ended. --no-watch-options-stdin Negative 'watch-options-stdin' option. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -335,11 +415,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'b' command using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'b' command using the "--help" option: stdout 1`] = ` -"Usage: webpack build|bundle|b [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack (default command, can be omitted). + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -362,12 +454,16 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -378,11 +474,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'build' and respect the "--color" flag using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'build' and respect the "--color" flag using the "--help" option: stdout 1`] = ` -"Usage: webpack build|bundle|b [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack (default command, can be omitted). + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -405,12 +513,16 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -421,11 +533,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'build' and respect the "--no-color" flag using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'build' and respect the "--no-color" flag using the "--help" option: stdout 1`] = ` -"Usage: webpack build|bundle|b [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack (default command, can be omitted). + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -448,12 +572,16 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -464,11 +592,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'build' command using command syntax: stderr 1`] = `""`; exports[`help should show help information for 'build' command using command syntax: stdout 1`] = ` -"Usage: webpack build|bundle|b [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack (default command, can be omitted). + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -491,12 +631,16 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -507,11 +651,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'build' command using the "--help verbose" option: stderr 1`] = `""`; exports[`help should show help information for 'build' command using the "--help verbose" option: stdout 1`] = ` -"Usage: webpack build|bundle|b [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack (default command, can be omitted). + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -536,12 +692,16 @@ Options: --watch-options-stdin Stop watching when stdin stream has ended. --no-watch-options-stdin Negative 'watch-options-stdin' option. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -552,11 +712,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'build' command using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'build' command using the "--help" option: stdout 1`] = ` -"Usage: webpack build|bundle|b [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack (default command, can be omitted). + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -579,12 +751,16 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -595,16 +771,29 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'configtest' and respect the "--color" flag using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'configtest' and respect the "--color" flag using the "--help" option: stdout 1`] = ` -"Usage: webpack configtest|t [config-path] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Validate a webpack configuration. + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -615,16 +804,29 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'configtest' and respect the "--no-color" flag using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'configtest' and respect the "--no-color" flag using the "--help" option: stdout 1`] = ` -"Usage: webpack configtest|t [config-path] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Validate a webpack configuration. + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -635,16 +837,29 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'configtest' command using command syntax: stderr 1`] = `""`; exports[`help should show help information for 'configtest' command using command syntax: stdout 1`] = ` -"Usage: webpack configtest|t [config-path] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Validate a webpack configuration. + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -655,16 +870,29 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'configtest' command using the "--help verbose" option: stderr 1`] = `""`; exports[`help should show help information for 'configtest' command using the "--help verbose" option: stdout 1`] = ` -"Usage: webpack configtest|t [config-path] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Validate a webpack configuration. + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -675,16 +903,29 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'configtest' command using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'configtest' command using the "--help" option: stdout 1`] = ` -"Usage: webpack configtest|t [config-path] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Validate a webpack configuration. + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -695,20 +936,36 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'i' command using command syntax: stderr 1`] = `""`; exports[`help should show help information for 'i' command using command syntax: stdout 1`] = ` -"Usage: webpack info|i [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Outputs information about your system. + Options: + -o, --output To get the output in a specified format (accept json or markdown) -a, --additional-package Adds additional packages to the output + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -719,20 +976,36 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'i' command using the "--help verbose" option: stderr 1`] = `""`; exports[`help should show help information for 'i' command using the "--help verbose" option: stdout 1`] = ` -"Usage: webpack info|i [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Outputs information about your system. + Options: + -o, --output To get the output in a specified format (accept json or markdown) -a, --additional-package Adds additional packages to the output + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -743,20 +1016,36 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'i' command using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'i' command using the "--help" option: stdout 1`] = ` -"Usage: webpack info|i [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Outputs information about your system. + Options: + -o, --output To get the output in a specified format (accept json or markdown) -a, --additional-package Adds additional packages to the output + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -767,20 +1056,36 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'info' and respect the "--color" flag using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'info' and respect the "--color" flag using the "--help" option: stdout 1`] = ` -"Usage: webpack info|i [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Outputs information about your system. + Options: + -o, --output To get the output in a specified format (accept json or markdown) -a, --additional-package Adds additional packages to the output + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -791,20 +1096,36 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'info' and respect the "--no-color" flag using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'info' and respect the "--no-color" flag using the "--help" option: stdout 1`] = ` -"Usage: webpack info|i [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Outputs information about your system. + Options: + -o, --output To get the output in a specified format (accept json or markdown) -a, --additional-package Adds additional packages to the output + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -815,20 +1136,36 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'info' command using command syntax: stderr 1`] = `""`; exports[`help should show help information for 'info' command using command syntax: stdout 1`] = ` -"Usage: webpack info|i [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Outputs information about your system. + Options: + -o, --output To get the output in a specified format (accept json or markdown) -a, --additional-package Adds additional packages to the output + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -839,20 +1176,36 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'info' command using the "--help verbose" option: stderr 1`] = `""`; exports[`help should show help information for 'info' command using the "--help verbose" option: stdout 1`] = ` -"Usage: webpack info|i [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Outputs information about your system. + Options: + -o, --output To get the output in a specified format (accept json or markdown) -a, --additional-package Adds additional packages to the output + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -863,20 +1216,36 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'info' command using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'info' command using the "--help" option: stdout 1`] = ` -"Usage: webpack info|i [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Outputs information about your system. + Options: + -o, --output To get the output in a specified format (accept json or markdown) -a, --additional-package Adds additional packages to the output + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -887,11 +1256,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 's' command using command syntax: stderr 1`] = `""`; exports[`help should show help information for 's' command using command syntax: stdout 1`] = ` -"Usage: webpack serve|server|s [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run the webpack dev server and watch for source file changes while serving. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -987,12 +1368,16 @@ Options: --no-web-socket-server Disallows to set web socket server and options. --web-socket-server-type Allows to set web socket server and options (by default 'ws'). + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1003,11 +1388,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 's' command using the "--help verbose" option: stderr 1`] = `""`; exports[`help should show help information for 's' command using the "--help verbose" option: stdout 1`] = ` -"Usage: webpack serve|server|s [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run the webpack dev server and watch for source file changes while serving. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -1028,12 +1425,16 @@ Options: --cache-max-generations Number of generations unused cache entries stay in memory cache at stack. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1044,11 +1445,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 's' command using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 's' command using the "--help" option: stdout 1`] = ` -"Usage: webpack serve|server|s [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run the webpack dev server and watch for source file changes while serving. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -1144,12 +1557,16 @@ Options: --no-web-socket-server Disallows to set web socket server and options. --web-socket-server-type Allows to set web socket server and options (by default 'ws'). + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1160,11 +1577,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'serve' and respect the "--color" flag using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'serve' and respect the "--color" flag using the "--help" option: stdout 1`] = ` -"Usage: webpack serve|server|s [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run the webpack dev server and watch for source file changes while serving. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -1260,12 +1689,16 @@ Options: --no-web-socket-server Disallows to set web socket server and options. --web-socket-server-type Allows to set web socket server and options (by default 'ws'). + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1276,11 +1709,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'serve' and respect the "--no-color" flag using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'serve' and respect the "--no-color" flag using the "--help" option: stdout 1`] = ` -"Usage: webpack serve|server|s [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run the webpack dev server and watch for source file changes while serving. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -1376,12 +1821,16 @@ Options: --no-web-socket-server Disallows to set web socket server and options. --web-socket-server-type Allows to set web socket server and options (by default 'ws'). + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1392,11 +1841,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'serve' command using command syntax: stderr 1`] = `""`; exports[`help should show help information for 'serve' command using command syntax: stdout 1`] = ` -"Usage: webpack serve|server|s [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run the webpack dev server and watch for source file changes while serving. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -1492,12 +1953,16 @@ Options: --no-web-socket-server Disallows to set web socket server and options. --web-socket-server-type Allows to set web socket server and options (by default 'ws'). + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1508,11 +1973,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'serve' command using the "--help verbose" option: stderr 1`] = `""`; exports[`help should show help information for 'serve' command using the "--help verbose" option: stdout 1`] = ` -"Usage: webpack serve|server|s [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run the webpack dev server and watch for source file changes while serving. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -1533,12 +2010,16 @@ Options: --cache-max-generations Number of generations unused cache entries stay in memory cache at stack. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1549,11 +2030,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'serve' command using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'serve' command using the "--help" option: stdout 1`] = ` -"Usage: webpack serve|server|s [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run the webpack dev server and watch for source file changes while serving. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -1649,12 +2142,16 @@ Options: --no-web-socket-server Disallows to set web socket server and options. --web-socket-server-type Allows to set web socket server and options (by default 'ws'). + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1665,11 +2162,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'server' command using command syntax: stderr 1`] = `""`; exports[`help should show help information for 'server' command using command syntax: stdout 1`] = ` -"Usage: webpack serve|server|s [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run the webpack dev server and watch for source file changes while serving. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -1765,12 +2274,16 @@ Options: --no-web-socket-server Disallows to set web socket server and options. --web-socket-server-type Allows to set web socket server and options (by default 'ws'). + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1781,11 +2294,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'server' command using the "--help verbose" option: stderr 1`] = `""`; exports[`help should show help information for 'server' command using the "--help verbose" option: stdout 1`] = ` -"Usage: webpack serve|server|s [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run the webpack dev server and watch for source file changes while serving. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -1806,12 +2331,16 @@ Options: --cache-max-generations Number of generations unused cache entries stay in memory cache at stack. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1822,11 +2351,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'server' command using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'server' command using the "--help" option: stdout 1`] = ` -"Usage: webpack serve|server|s [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run the webpack dev server and watch for source file changes while serving. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -1922,12 +2463,16 @@ Options: --no-web-socket-server Disallows to set web socket server and options. --web-socket-server-type Allows to set web socket server and options (by default 'ws'). + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1938,16 +2483,29 @@ Made with ♥ by the webpack team." exports[`help should show help information for 't' command using command syntax: stderr 1`] = `""`; exports[`help should show help information for 't' command using command syntax: stdout 1`] = ` -"Usage: webpack configtest|t [config-path] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Validate a webpack configuration. + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1958,16 +2516,29 @@ Made with ♥ by the webpack team." exports[`help should show help information for 't' command using the "--help verbose" option: stderr 1`] = `""`; exports[`help should show help information for 't' command using the "--help verbose" option: stdout 1`] = ` -"Usage: webpack configtest|t [config-path] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Validate a webpack configuration. + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1978,16 +2549,29 @@ Made with ♥ by the webpack team." exports[`help should show help information for 't' command using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 't' command using the "--help" option: stdout 1`] = ` -"Usage: webpack configtest|t [config-path] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Validate a webpack configuration. + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -1998,11 +2582,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'w' command using command syntax: stderr 1`] = `""`; exports[`help should show help information for 'w' command using command syntax: stdout 1`] = ` -"Usage: webpack watch|w [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack and watch for files changes. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -2024,12 +2620,16 @@ Options: -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -2040,11 +2640,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'w' command using the "--help verbose" option: stderr 1`] = `""`; exports[`help should show help information for 'w' command using the "--help verbose" option: stdout 1`] = ` -"Usage: webpack watch|w [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack and watch for files changes. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -2069,12 +2681,16 @@ Options: --watch-options-stdin Stop watching when stdin stream has ended. --no-watch-options-stdin Negative 'watch-options-stdin' option. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -2085,11 +2701,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'w' command using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'w' command using the "--help" option: stdout 1`] = ` -"Usage: webpack watch|w [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack and watch for files changes. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -2111,12 +2739,16 @@ Options: -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -2127,11 +2759,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'watch' and respect the "--color" flag using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'watch' and respect the "--color" flag using the "--help" option: stdout 1`] = ` -"Usage: webpack watch|w [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack and watch for files changes. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -2153,12 +2797,16 @@ Options: -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -2169,11 +2817,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'watch' and respect the "--no-color" flag using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'watch' and respect the "--no-color" flag using the "--help" option: stdout 1`] = ` -"Usage: webpack watch|w [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack and watch for files changes. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -2195,12 +2855,16 @@ Options: -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -2211,11 +2875,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'watch' command using command syntax: stderr 1`] = `""`; exports[`help should show help information for 'watch' command using command syntax: stdout 1`] = ` -"Usage: webpack watch|w [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack and watch for files changes. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -2237,12 +2913,16 @@ Options: -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -2253,11 +2933,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'watch' command using the "--help verbose" option: stderr 1`] = `""`; exports[`help should show help information for 'watch' command using the "--help verbose" option: stdout 1`] = ` -"Usage: webpack watch|w [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack and watch for files changes. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -2282,12 +2974,16 @@ Options: --watch-options-stdin Stop watching when stdin stream has ended. --no-watch-options-stdin Negative 'watch-options-stdin' option. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -2298,11 +2994,23 @@ Made with ♥ by the webpack team." exports[`help should show help information for 'watch' command using the "--help" option: stderr 1`] = `""`; exports[`help should show help information for 'watch' command using the "--help" option: stdout 1`] = ` -"Usage: webpack watch|w [entries...] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Run webpack and watch for files changes. + Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -2324,12 +3032,16 @@ Options: -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -2340,12 +3052,21 @@ Made with ♥ by the webpack team." exports[`help should show help information using command syntax: stderr 1`] = `""`; exports[`help should show help information using command syntax: stdout 1`] = ` -"Usage: webpack [entries...] [options] -Alternative usage to run commands: webpack [command] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + -The build tool for modern web applications. Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -2368,13 +3089,19 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + + Commands: + build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). configtest|t [config-path] Validate a webpack configuration. help|h [command] [option] Display help for commands and options. @@ -2383,6 +3110,7 @@ Commands: version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. watch|w [entries...] [options] Run webpack and watch for files changes. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -2393,10 +3121,12 @@ Made with ♥ by the webpack team." exports[`help should show help information using the "--help" option with the "verbose" value #2: stderr 1`] = `""`; exports[`help should show help information using the "--help" option with the "verbose" value #2: stdout 1`] = ` -"Usage: webpack [entries...] [options] -Alternative usage to run commands: webpack [command] [options] +" + ○ webpack ○ -The build tool for modern web applications. + https://webpack.js.org + + The build t ... Webpack documentation: https://webpack.js.org/. CLI documentation: https://webpack.js.org/api/cli/. @@ -2406,10 +3136,12 @@ Made with ♥ by the webpack team." exports[`help should show help information using the "--help" option with the "verbose" value: stderr 1`] = `""`; exports[`help should show help information using the "--help" option with the "verbose" value: stdout 1`] = ` -"Usage: webpack [entries...] [options] -Alternative usage to run commands: webpack [command] [options] +" + ○ webpack ○ + + https://webpack.js.org -The build tool for modern web applications. + The build t ... Webpack documentation: https://webpack.js.org/. CLI documentation: https://webpack.js.org/api/cli/. @@ -2419,12 +3151,21 @@ Made with ♥ by the webpack team." exports[`help should show help information using the "--help" option: stderr 1`] = `""`; exports[`help should show help information using the "--help" option: stdout 1`] = ` -"Usage: webpack [entries...] [options] -Alternative usage to run commands: webpack [command] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + -The build tool for modern web applications. Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -2447,13 +3188,19 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + + Commands: + build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). configtest|t [config-path] Validate a webpack configuration. help|h [command] [option] Display help for commands and options. @@ -2462,6 +3209,7 @@ Commands: version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. watch|w [entries...] [options] Run webpack and watch for files changes. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -2650,20 +3398,36 @@ Made with ♥ by the webpack team." exports[`help should show help information with options for sub commands: stderr 1`] = `""`; exports[`help should show help information with options for sub commands: stdout 1`] = ` -"Usage: webpack info|i [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + Outputs information about your system. + Options: + -o, --output To get the output in a specified format (accept json or markdown) -a, --additional-package Adds additional packages to the output + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -2676,12 +3440,21 @@ exports[`help should show the same information using the "--help" option and com exports[`help should show the same information using the "--help" option and command syntax: stderr from option 1`] = `""`; exports[`help should show the same information using the "--help" option and command syntax: stdout from command syntax 1`] = ` -"Usage: webpack [entries...] [options] -Alternative usage to run commands: webpack [command] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + -The build tool for modern web applications. Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -2704,13 +3477,19 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + + Commands: + build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). configtest|t [config-path] Validate a webpack configuration. help|h [command] [option] Display help for commands and options. @@ -2719,6 +3498,7 @@ Commands: version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. watch|w [entries...] [options] Run webpack and watch for files changes. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. @@ -2727,12 +3507,21 @@ Made with ♥ by the webpack team." `; exports[`help should show the same information using the "--help" option and command syntax: stdout from option 1`] = ` -"Usage: webpack [entries...] [options] -Alternative usage to run commands: webpack [command] [options] +" + ○ webpack ○ + + https://webpack.js.org + + The build tool for modern web applications + + Usage: \`webpack [...options] | \` + + Example: \`webpack help --flag | \` + -The build tool for modern web applications. Options: + -c, --config Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js". --config-name Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations. -m, --merge Merge two or more configurations using 'webpack-merge'. @@ -2755,13 +3544,19 @@ Options: -w, --watch Enter watch mode, which rebuilds on file change. --watch-options-stdin Stop watching when stdin stream has ended. + + Global options: + --color Enable colors on console. --no-color Disable colors on console. -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. -h, --help [verbose] Display help for commands and options. + + Commands: + build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). configtest|t [config-path] Validate a webpack configuration. help|h [command] [option] Display help for commands and options. @@ -2770,6 +3565,7 @@ Commands: version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and other packages. watch|w [entries...] [options] Run webpack and watch for files changes. + To see list of all supported commands and options run 'webpack --help=verbose'. Webpack documentation: https://webpack.js.org/. diff --git a/test/help/help.test.js b/test/help/help.test.js index b8d844a7c1d..1d4e1e53ced 100644 --- a/test/help/help.test.js +++ b/test/help/help.test.js @@ -5,8 +5,19 @@ const { pathToFileURL } = require("node:url"); const { normalizeStderr, normalizeStdout, run } = require("../utils/test-utils"); const nodeOptions = [`--import=${pathToFileURL(path.resolve(__dirname, "./set-blocking.js"))}`]; +const columns80NodeOptions = [ + ...nodeOptions, + `--import=${pathToFileURL(path.resolve(__dirname, "./set-columns-80.js"))}`, +]; +const columns120NodeOptions = [ + ...nodeOptions, + `--import=${pathToFileURL(path.resolve(__dirname, "./set-columns-120.js"))}`, +]; describe("help", () => { + const getLeadingSpaces = (value) => value.length - value.trimStart().length; + const stripAnsi = (value) => value.replaceAll(/\u001B\[[0-9;]*m/g, ""); + it('should show help information using the "--help" option', async () => { const { exitCode, stderr, stdout } = await run(__dirname, ["--help"]); @@ -319,6 +330,37 @@ describe("help", () => { expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); + it("should center the branded help banner based on terminal width", async () => { + const { stdout: stdout80 } = await run(__dirname, ["--help"], { + nodeOptions: columns80NodeOptions, + }); + const { stdout: stdout120 } = await run(__dirname, ["--help"], { + nodeOptions: columns120NodeOptions, + }); + + const titleLine80 = stdout80.split("\n").find((line) => line.includes("webpack")); + const titleLine120 = stdout120.split("\n").find((line) => line.includes("webpack")); + const linkLine80 = stdout80.split("\n").find((line) => line.includes("https://webpack.js.org")); + const linkLine120 = stdout120 + .split("\n") + .find((line) => line.includes("https://webpack.js.org")); + + expect(getLeadingSpaces(titleLine80)).toBe( + Math.max(0, Math.floor((80 - stripAnsi(titleLine80.trimStart()).length) / 2)), + ); + expect(getLeadingSpaces(linkLine80)).toBe( + Math.max(0, Math.floor((80 - stripAnsi(linkLine80.trimStart()).length) / 2)), + ); + expect(getLeadingSpaces(titleLine120)).toBe( + Math.max(0, Math.floor((120 - stripAnsi(titleLine120.trimStart()).length) / 2)), + ); + expect(getLeadingSpaces(linkLine120)).toBe( + Math.max(0, Math.floor((120 - stripAnsi(linkLine120.trimStart()).length) / 2)), + ); + expect(getLeadingSpaces(titleLine120)).toBeGreaterThan(getLeadingSpaces(titleLine80)); + expect(getLeadingSpaces(linkLine120)).toBeGreaterThan(getLeadingSpaces(linkLine80)); + }); + it('should log error for invalid command using the "--help" option', async () => { const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "myCommand"]); diff --git a/test/help/set-columns-120.js b/test/help/set-columns-120.js new file mode 100644 index 00000000000..9289800664d --- /dev/null +++ b/test/help/set-columns-120.js @@ -0,0 +1,4 @@ +Object.defineProperty(process.stdout, "columns", { + configurable: true, + value: 120, +}); diff --git a/test/help/set-columns-80.js b/test/help/set-columns-80.js new file mode 100644 index 00000000000..c8b832134e9 --- /dev/null +++ b/test/help/set-columns-80.js @@ -0,0 +1,4 @@ +Object.defineProperty(process.stdout, "columns", { + configurable: true, + value: 80, +}); From 6f75e5b2cbe12ee52a62137d883034201a3c4728 Mon Sep 17 00:00:00 2001 From: stefan binoj Date: Mon, 9 Mar 2026 20:38:09 +0530 Subject: [PATCH 2/7] remove duplication --- packages/webpack-cli/src/webpack-cli.ts | 43 ++++++++----------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/packages/webpack-cli/src/webpack-cli.ts b/packages/webpack-cli/src/webpack-cli.ts index cf7a4ac36f9..103e7961340 100644 --- a/packages/webpack-cli/src/webpack-cli.ts +++ b/packages/webpack-cli/src/webpack-cli.ts @@ -1269,35 +1269,20 @@ class WebpackCLI { "`webpack help --flag | `", )}`; - output = isGlobalHelp - ? [ - "", - bannerTitle, - "", - bannerLink, - "", - descriptionLine, - "", - centerBannerLine(usageLine), - "", - centerBannerLine(exampleLine), - "", - "", - ] - : [ - "", - bannerTitle, - "", - bannerLink, - "", - descriptionLine, - "", - centerBannerLine(usageLine), - "", - centerBannerLine(exampleLine), - "", - "", - ]; + output = [ + "", + bannerTitle, + "", + bannerLink, + "", + descriptionLine, + "", + centerBannerLine(usageLine), + "", + centerBannerLine(exampleLine), + "", + "", + ]; // Description const commandDescription = isGlobalHelp ? "" : helper.commandDescription(command); From b2d5aa257f93b9a71f4343ea0662e3c476d7fff5 Mon Sep 17 00:00:00 2001 From: stefan binoj Date: Mon, 9 Mar 2026 22:05:32 +0530 Subject: [PATCH 3/7] minnify code --- packages/webpack-cli/src/webpack-cli.ts | 28 ++++++------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/packages/webpack-cli/src/webpack-cli.ts b/packages/webpack-cli/src/webpack-cli.ts index 103e7961340..356d0289bb7 100644 --- a/packages/webpack-cli/src/webpack-cli.ts +++ b/packages/webpack-cli/src/webpack-cli.ts @@ -100,7 +100,6 @@ type CommanderArgs = Record; type BasicPrimitive = string | boolean | number; type EnumValue = string | number | boolean | EnumValueObject | EnumValue[] | null; -type HelpColorFormatter = "dim" | "underline" | "yellow" | "bold"; interface EnumValueObject { [key: string]: EnumValue; @@ -1212,11 +1211,6 @@ class WebpackCLI { ); }, formatHelp: (command, helper: Help) => { - const renderText = (formatterName: HelpColorFormatter, value: string): string => { - const formatter = this.colors[formatterName]; - return typeof formatter === "function" ? formatter(value) : value; - }; - const underlineText = (value: string) => this.colors.isColorSupported ? `\u001B[4m${value}\u001B[24m` : value; @@ -1249,25 +1243,15 @@ class WebpackCLI { let output: string[] = []; - const bannerTitleText = `${renderText("dim", "○")} ${renderText( - "underline", - renderText("dim", "webpack"), - )} ${renderText("dim", "○")}`; + const bannerTitleText = `${this.colors.dim("○")} ${this.colors.underline( + this.colors.dim("webpack"), + )} ${this.colors.dim("○")}`; const bannerTitle = centerBannerLine(bannerTitleText); - const bannerLinkText = renderText( - "underline", - renderText("dim", "https://webpack.js.org"), - ); + const bannerLinkText = this.colors.underline(this.colors.dim("https://webpack.js.org")); const bannerLink = centerBannerLine(bannerLinkText); const descriptionLine = centerBannerLine("The build tool for modern web applications"); - const usageLine = `${renderText("bold", "Usage:")} ${renderText( - "yellow", - "`webpack [...options] | `", - )}`; - const exampleLine = `${renderText("bold", "Example:")} ${renderText( - "yellow", - "`webpack help --flag | `", - )}`; + const usageLine = `${this.colors.bold("Usage:")} ${this.colors.yellow("`webpack [...options] | `")}`; + const exampleLine = `${this.colors.bold("Example:")} ${this.colors.yellow("`webpack help --flag | `")}`; output = [ "", From e389c9c2b2a5a83e1c49fd09a8ca7127d2a7a20f Mon Sep 17 00:00:00 2001 From: stefan binoj Date: Mon, 9 Mar 2026 22:11:31 +0530 Subject: [PATCH 4/7] more reduction to code --- packages/webpack-cli/src/webpack-cli.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/webpack-cli/src/webpack-cli.ts b/packages/webpack-cli/src/webpack-cli.ts index 356d0289bb7..534c3f14742 100644 --- a/packages/webpack-cli/src/webpack-cli.ts +++ b/packages/webpack-cli/src/webpack-cli.ts @@ -1127,7 +1127,7 @@ class WebpackCLI { value === "--version" || value === "-h" || value === "--help"; - const { bold } = this.colors; + const { bold, dim, underline, yellow } = this.colors; const outputIncorrectUsageOfHelp = () => { this.logger.error("Incorrect use of help"); this.logger.error( @@ -1222,7 +1222,7 @@ class WebpackCLI { return `${" ".repeat(leftPadding)}${value}`; }; const formatTabularItem = (term: string, description: string, padWidth: number) => { - const formattedTerm = isGlobalHelp ? bold(term) : term; + const formattedTerm = bold(term); if (description) { return helper.formatItem(formattedTerm, padWidth, description, helper); @@ -1243,15 +1243,15 @@ class WebpackCLI { let output: string[] = []; - const bannerTitleText = `${this.colors.dim("○")} ${this.colors.underline( - this.colors.dim("webpack"), - )} ${this.colors.dim("○")}`; + const bannerTitleText = `${dim("○")} ${underline( + dim("webpack"), + )} ${dim("○")}`; const bannerTitle = centerBannerLine(bannerTitleText); - const bannerLinkText = this.colors.underline(this.colors.dim("https://webpack.js.org")); + const bannerLinkText = underline(dim("https://webpack.js.org")); const bannerLink = centerBannerLine(bannerLinkText); const descriptionLine = centerBannerLine("The build tool for modern web applications"); - const usageLine = `${this.colors.bold("Usage:")} ${this.colors.yellow("`webpack [...options] | `")}`; - const exampleLine = `${this.colors.bold("Example:")} ${this.colors.yellow("`webpack help --flag | `")}`; + const usageLine = `${bold("Usage:")} ${yellow("`webpack [...options] | `")}`; + const exampleLine = `${bold("Example:")} ${yellow("`webpack help --flag | `")}`; output = [ "", From 4e7940f82ae8508558292587d178cf16c5f7ccc0 Mon Sep 17 00:00:00 2001 From: stefan binoj Date: Tue, 10 Mar 2026 08:16:34 +0530 Subject: [PATCH 5/7] update formatting --- packages/webpack-cli/src/webpack-cli.ts | 63 ++++++++++++------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/packages/webpack-cli/src/webpack-cli.ts b/packages/webpack-cli/src/webpack-cli.ts index 534c3f14742..27f3ff06dbe 100644 --- a/packages/webpack-cli/src/webpack-cli.ts +++ b/packages/webpack-cli/src/webpack-cli.ts @@ -1155,10 +1155,9 @@ class WebpackCLI { parentCmdNames = `${parentCmd.name()} ${parentCmdNames}`; } + // remove if (isGlobalHelp) { - return `${parentCmdNames}${command.usage()}\n${bold( - "Alternative usage to run commands:", - )} ${parentCmdNames}[command] [options]`; + return `${parentCmdNames}${command.usage()}`; } return `${parentCmdNames}${command.name()}|${command @@ -1211,16 +1210,6 @@ class WebpackCLI { ); }, formatHelp: (command, helper: Help) => { - const underlineText = (value: string) => - this.colors.isColorSupported ? `\u001B[4m${value}\u001B[24m` : value; - - const columns = process.stdout.columns || 80; - const centerBannerLine = (value: string) => { - const visibleWidth = stripVTControlCharacters(value).length; - const leftPadding = Math.max(0, Math.floor((columns - visibleWidth) / 2)); - - return `${" ".repeat(leftPadding)}${value}`; - }; const formatTabularItem = (term: string, description: string, padWidth: number) => { const formattedTerm = bold(term); @@ -1231,16 +1220,24 @@ class WebpackCLI { return formattedTerm; }; + const columns = process.stdout.columns || 80; + const centerBannerLine = (value: string) => { + const visibleWidth = stripVTControlCharacters(value).length; + const leftPadding = Math.max(0, Math.floor((columns - visibleWidth) / 2)); + + return `${" ".repeat(leftPadding)}${value}`; + }; + const formatList = (textArray: string[]) => textArray.join("\n").replaceAll(/^/gm, ""); const formatSection = (title: string, textArray: string[]) => { if (textArray.length === 0) { return ""; } - return ["", underlineText(bold(title)), "", formatList(textArray), "", ""]; + return ["", underline(bold(title)), "", formatList(textArray), "", ""]; }; - const padWidth = helper.padWidth(command, helper); + const padWidth = helper.padWidth(command, helper); let output: string[] = []; const bannerTitleText = `${dim("○")} ${underline( @@ -1250,23 +1247,25 @@ class WebpackCLI { const bannerLinkText = underline(dim("https://webpack.js.org")); const bannerLink = centerBannerLine(bannerLinkText); const descriptionLine = centerBannerLine("The build tool for modern web applications"); - const usageLine = `${bold("Usage:")} ${yellow("`webpack [...options] | `")}`; - const exampleLine = `${bold("Example:")} ${yellow("`webpack help --flag | `")}`; - - output = [ - "", - bannerTitle, - "", - bannerLink, - "", - descriptionLine, - "", - centerBannerLine(usageLine), - "", - centerBannerLine(exampleLine), - "", - "", - ]; + const usageLine = `${bold("Usage:")} ${yellow(helper.commandUsage(command))}`; + const exampleLine = `${bold("Example:")} ${yellow("webpack help --flag | ")}`; + + output = isGlobalHelp + ? [ + "", + bannerTitle, + "", + bannerLink, + "", + descriptionLine, + "", + centerBannerLine(usageLine), + "", + centerBannerLine(exampleLine), + "", + "", + ] + : ["", bannerTitle, "", bannerLink, "", centerBannerLine(usageLine), "", ""]; // Description const commandDescription = isGlobalHelp ? "" : helper.commandDescription(command); From 17f2795d38a4622d99d92960ca6eb036cb9ad43d Mon Sep 17 00:00:00 2001 From: stefan binoj Date: Tue, 10 Mar 2026 08:34:05 +0530 Subject: [PATCH 6/7] snapshot fix for new formatting --- .../help.test.js.snap.devServer5.webpack5 | 292 ++++-------------- 1 file changed, 58 insertions(+), 234 deletions(-) diff --git a/test/help/__snapshots__/help.test.js.snap.devServer5.webpack5 b/test/help/__snapshots__/help.test.js.snap.devServer5.webpack5 index 2703202a6d6..64fbcc12ad1 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer5.webpack5 +++ b/test/help/__snapshots__/help.test.js.snap.devServer5.webpack5 @@ -95,9 +95,9 @@ exports[`help should show help information and respect the "--color" flag using The build tool for modern web applications - Usage: \`webpack [...options] | \` + Usage: webpack [entries...] [options] - Example: \`webpack help --flag | \` + Example: webpack help --flag | @@ -164,9 +164,9 @@ exports[`help should show help information and respect the "--no-color" flag usi The build tool for modern web applications - Usage: \`webpack [...options] | \` + Usage: webpack [entries...] [options] - Example: \`webpack help --flag | \` + Example: webpack help --flag | @@ -233,9 +233,9 @@ exports[`help should show help information and taking precedence when "--help" a The build tool for modern web applications - Usage: \`webpack [...options] | \` + Usage: webpack [entries...] [options] - Example: \`webpack help --flag | \` + Example: webpack help --flag | @@ -300,11 +300,7 @@ exports[`help should show help information for 'b' command using command syntax: https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). @@ -359,11 +355,7 @@ exports[`help should show help information for 'b' command using the "--help ver https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). @@ -420,11 +412,7 @@ exports[`help should show help information for 'b' command using the "--help" op https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). @@ -479,11 +467,7 @@ exports[`help should show help information for 'build' and respect the "--color" https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). @@ -538,11 +522,7 @@ exports[`help should show help information for 'build' and respect the "--no-col https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). @@ -597,11 +577,7 @@ exports[`help should show help information for 'build' command using command syn https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). @@ -656,11 +632,7 @@ exports[`help should show help information for 'build' command using the "--help https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). @@ -717,11 +689,7 @@ exports[`help should show help information for 'build' command using the "--help https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack build|bundle|b [entries...] [options] Run webpack (default command, can be omitted). @@ -776,11 +744,7 @@ exports[`help should show help information for 'configtest' and respect the "--c https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack configtest|t [config-path] Validate a webpack configuration. @@ -809,11 +773,7 @@ exports[`help should show help information for 'configtest' and respect the "--n https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack configtest|t [config-path] Validate a webpack configuration. @@ -842,11 +802,7 @@ exports[`help should show help information for 'configtest' command using comman https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack configtest|t [config-path] Validate a webpack configuration. @@ -875,11 +831,7 @@ exports[`help should show help information for 'configtest' command using the "- https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack configtest|t [config-path] Validate a webpack configuration. @@ -908,11 +860,7 @@ exports[`help should show help information for 'configtest' command using the "- https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack configtest|t [config-path] Validate a webpack configuration. @@ -941,11 +889,7 @@ exports[`help should show help information for 'i' command using command syntax: https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack info|i [options] Outputs information about your system. @@ -981,11 +925,7 @@ exports[`help should show help information for 'i' command using the "--help ver https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack info|i [options] Outputs information about your system. @@ -1021,11 +961,7 @@ exports[`help should show help information for 'i' command using the "--help" op https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack info|i [options] Outputs information about your system. @@ -1061,11 +997,7 @@ exports[`help should show help information for 'info' and respect the "--color" https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack info|i [options] Outputs information about your system. @@ -1101,11 +1033,7 @@ exports[`help should show help information for 'info' and respect the "--no-colo https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack info|i [options] Outputs information about your system. @@ -1141,11 +1069,7 @@ exports[`help should show help information for 'info' command using command synt https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack info|i [options] Outputs information about your system. @@ -1181,11 +1105,7 @@ exports[`help should show help information for 'info' command using the "--help https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack info|i [options] Outputs information about your system. @@ -1221,11 +1141,7 @@ exports[`help should show help information for 'info' command using the "--help" https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack info|i [options] Outputs information about your system. @@ -1261,11 +1177,7 @@ exports[`help should show help information for 's' command using command syntax: https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. @@ -1393,11 +1305,7 @@ exports[`help should show help information for 's' command using the "--help ver https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. @@ -1450,11 +1358,7 @@ exports[`help should show help information for 's' command using the "--help" op https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. @@ -1582,11 +1486,7 @@ exports[`help should show help information for 'serve' and respect the "--color" https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. @@ -1714,11 +1614,7 @@ exports[`help should show help information for 'serve' and respect the "--no-col https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. @@ -1846,11 +1742,7 @@ exports[`help should show help information for 'serve' command using command syn https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. @@ -1978,11 +1870,7 @@ exports[`help should show help information for 'serve' command using the "--help https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. @@ -2035,11 +1923,7 @@ exports[`help should show help information for 'serve' command using the "--help https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. @@ -2167,11 +2051,7 @@ exports[`help should show help information for 'server' command using command sy https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. @@ -2299,11 +2179,7 @@ exports[`help should show help information for 'server' command using the "--hel https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. @@ -2356,11 +2232,7 @@ exports[`help should show help information for 'server' command using the "--hel https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. @@ -2488,11 +2360,7 @@ exports[`help should show help information for 't' command using command syntax: https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack configtest|t [config-path] Validate a webpack configuration. @@ -2521,11 +2389,7 @@ exports[`help should show help information for 't' command using the "--help ver https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack configtest|t [config-path] Validate a webpack configuration. @@ -2554,11 +2418,7 @@ exports[`help should show help information for 't' command using the "--help" op https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack configtest|t [config-path] Validate a webpack configuration. @@ -2587,11 +2447,7 @@ exports[`help should show help information for 'w' command using command syntax: https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack watch|w [entries...] [options] Run webpack and watch for files changes. @@ -2645,11 +2501,7 @@ exports[`help should show help information for 'w' command using the "--help ver https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack watch|w [entries...] [options] Run webpack and watch for files changes. @@ -2706,11 +2558,7 @@ exports[`help should show help information for 'w' command using the "--help" op https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack watch|w [entries...] [options] Run webpack and watch for files changes. @@ -2764,11 +2612,7 @@ exports[`help should show help information for 'watch' and respect the "--color" https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack watch|w [entries...] [options] Run webpack and watch for files changes. @@ -2822,11 +2666,7 @@ exports[`help should show help information for 'watch' and respect the "--no-col https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack watch|w [entries...] [options] Run webpack and watch for files changes. @@ -2880,11 +2720,7 @@ exports[`help should show help information for 'watch' command using command syn https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack watch|w [entries...] [options] Run webpack and watch for files changes. @@ -2938,11 +2774,7 @@ exports[`help should show help information for 'watch' command using the "--help https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack watch|w [entries...] [options] Run webpack and watch for files changes. @@ -2999,11 +2831,7 @@ exports[`help should show help information for 'watch' command using the "--help https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack watch|w [entries...] [options] Run webpack and watch for files changes. @@ -3059,9 +2887,9 @@ exports[`help should show help information using command syntax: stdout 1`] = ` The build tool for modern web applications - Usage: \`webpack [...options] | \` + Usage: webpack [entries...] [options] - Example: \`webpack help --flag | \` + Example: webpack help --flag | @@ -3158,9 +2986,9 @@ exports[`help should show help information using the "--help" option: stdout 1`] The build tool for modern web applications - Usage: \`webpack [...options] | \` + Usage: webpack [entries...] [options] - Example: \`webpack help --flag | \` + Example: webpack help --flag | @@ -3403,11 +3231,7 @@ exports[`help should show help information with options for sub commands: stdout https://webpack.js.org - The build tool for modern web applications - - Usage: \`webpack [...options] | \` - - Example: \`webpack help --flag | \` + Usage: webpack info|i [options] Outputs information about your system. @@ -3447,9 +3271,9 @@ exports[`help should show the same information using the "--help" option and com The build tool for modern web applications - Usage: \`webpack [...options] | \` + Usage: webpack [entries...] [options] - Example: \`webpack help --flag | \` + Example: webpack help --flag | @@ -3514,9 +3338,9 @@ exports[`help should show the same information using the "--help" option and com The build tool for modern web applications - Usage: \`webpack [...options] | \` + Usage: webpack [entries...] [options] - Example: \`webpack help --flag | \` + Example: webpack help --flag | From 6c97df26882276ab13365d0572fcc0c3b87b42ae Mon Sep 17 00:00:00 2001 From: stefan binoj Date: Tue, 10 Mar 2026 12:18:36 +0530 Subject: [PATCH 7/7] remove comments --- packages/webpack-cli/src/webpack-cli.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/webpack-cli/src/webpack-cli.ts b/packages/webpack-cli/src/webpack-cli.ts index 27f3ff06dbe..5a4c4d7ec7b 100644 --- a/packages/webpack-cli/src/webpack-cli.ts +++ b/packages/webpack-cli/src/webpack-cli.ts @@ -1155,7 +1155,6 @@ class WebpackCLI { parentCmdNames = `${parentCmd.name()} ${parentCmdNames}`; } - // remove if (isGlobalHelp) { return `${parentCmdNames}${command.usage()}`; }