diff --git a/packages/webpack-cli/src/webpack-cli.ts b/packages/webpack-cli/src/webpack-cli.ts index cf0f172159b..5a4c4d7ec7b 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, @@ -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( @@ -1156,9 +1156,7 @@ class WebpackCLI { } 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,23 +1209,65 @@ class WebpackCLI { ); }, formatHelp: (command, helper: Help) => { - const formatItem = (term: string, description: string) => { + const formatTabularItem = (term: string, description: string, padWidth: number) => { + const formattedTerm = bold(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 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 ["", underline(bold(title)), "", formatList(textArray), "", ""]; + }; - // Usage - let output = [`${bold("Usage:")} ${helper.commandUsage(command)}`, ""]; + const padWidth = helper.padWidth(command, helper); + let output: string[] = []; + + const bannerTitleText = `${dim("○")} ${underline( + dim("webpack"), + )} ${dim("○")}`; + const bannerTitle = centerBannerLine(bannerTitleText); + 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(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 - ? "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 +1276,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..64fbcc12ad1 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 [entries...] [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 [entries...] [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 [entries...] [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,19 @@ 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 + + Usage: webpack build|bundle|b [entries...] [options] + 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 +330,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 +350,19 @@ 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 + + Usage: webpack build|bundle|b [entries...] [options] + 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 +387,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 +407,19 @@ 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 + + Usage: webpack build|bundle|b [entries...] [options] + 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 +442,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 +462,19 @@ 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 + + Usage: webpack build|bundle|b [entries...] [options] + 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 +497,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 +517,19 @@ 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 + + Usage: webpack build|bundle|b [entries...] [options] + 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 +552,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 +572,19 @@ 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 + + Usage: webpack build|bundle|b [entries...] [options] + 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 +607,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 +627,19 @@ 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 + + Usage: webpack build|bundle|b [entries...] [options] + 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 +664,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 +684,19 @@ 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 + + Usage: webpack build|bundle|b [entries...] [options] + 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 +719,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 +739,25 @@ 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 + + Usage: webpack configtest|t [config-path] + 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 +768,25 @@ 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 + + Usage: webpack configtest|t [config-path] + 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 +797,25 @@ 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 + + Usage: webpack configtest|t [config-path] + 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 +826,25 @@ 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 + + Usage: webpack configtest|t [config-path] + 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 +855,25 @@ 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 + + Usage: webpack configtest|t [config-path] + 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 +884,32 @@ 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 + + Usage: webpack info|i [options] + 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 +920,32 @@ 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 + + Usage: webpack info|i [options] + 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 +956,32 @@ 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 + + Usage: webpack info|i [options] + 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 +992,32 @@ 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 + + Usage: webpack info|i [options] + 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 +1028,32 @@ 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 + + Usage: webpack info|i [options] + 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 +1064,32 @@ 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 + + Usage: webpack info|i [options] + 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 +1100,32 @@ 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 + + Usage: webpack info|i [options] + 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 +1136,32 @@ 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 + + Usage: webpack info|i [options] + 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 +1172,19 @@ 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 + + Usage: webpack serve|server|s [entries...] [options] + 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 +1280,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 +1300,19 @@ 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 + + Usage: webpack serve|server|s [entries...] [options] + 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 +1333,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 +1353,19 @@ 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 + + Usage: webpack serve|server|s [entries...] [options] + 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 +1461,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 +1481,19 @@ 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 + + Usage: webpack serve|server|s [entries...] [options] + 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 +1589,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 +1609,19 @@ 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 + + Usage: webpack serve|server|s [entries...] [options] + 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 +1717,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 +1737,19 @@ 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 + + Usage: webpack serve|server|s [entries...] [options] + 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 +1845,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 +1865,19 @@ 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 + + Usage: webpack serve|server|s [entries...] [options] + 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 +1898,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 +1918,19 @@ 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 + + Usage: webpack serve|server|s [entries...] [options] + 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 +2026,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 +2046,19 @@ 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 + + Usage: webpack serve|server|s [entries...] [options] + 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 +2154,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 +2174,19 @@ 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 + + Usage: webpack serve|server|s [entries...] [options] + 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 +2207,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 +2227,19 @@ 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 + + Usage: webpack serve|server|s [entries...] [options] + 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 +2335,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 +2355,25 @@ 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 + + Usage: webpack configtest|t [config-path] + 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 +2384,25 @@ 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 + + Usage: webpack configtest|t [config-path] + 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 +2413,25 @@ 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 + + Usage: webpack configtest|t [config-path] + 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 +2442,19 @@ 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 + + Usage: webpack watch|w [entries...] [options] + 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 +2476,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 +2496,19 @@ 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 + + Usage: webpack watch|w [entries...] [options] + 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 +2533,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 +2553,19 @@ 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 + + Usage: webpack watch|w [entries...] [options] + 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 +2587,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 +2607,19 @@ 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 + + Usage: webpack watch|w [entries...] [options] + 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 +2641,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 +2661,19 @@ 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 + + Usage: webpack watch|w [entries...] [options] + 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 +2695,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 +2715,19 @@ 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 + + Usage: webpack watch|w [entries...] [options] + 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 +2749,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 +2769,19 @@ 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 + + Usage: webpack watch|w [entries...] [options] + 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 +2806,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 +2826,19 @@ 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 + + Usage: webpack watch|w [entries...] [options] + 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 +2860,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 +2880,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 [entries...] [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 +2917,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 +2938,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 +2949,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 +2964,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 +2979,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 [entries...] [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 +3016,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 +3037,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 +3226,32 @@ 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 + + Usage: webpack info|i [options] + 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 +3264,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 [entries...] [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 +3301,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 +3322,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 +3331,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 [entries...] [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 +3368,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 +3389,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, +});