From ad96398738606217675914e5ffa3623e4e739f3c Mon Sep 17 00:00:00 2001 From: Aviv Keller Date: Sat, 31 Jan 2026 13:36:48 -0500 Subject: [PATCH 1/2] chore: use commander built-ins over custom implementations --- .cspell.json | 11 +- package-lock.json | 11 +- packages/configtest/src/index.ts | 18 +- packages/info/src/index.ts | 18 +- packages/serve/src/index.ts | 70 +- packages/webpack-cli/package.json | 1 - packages/webpack-cli/src/bootstrap.ts | 3 + packages/webpack-cli/src/types.ts | 38 +- packages/webpack-cli/src/webpack-cli.ts | 1171 ++----- test/api/CLI.test.js | 906 +++-- .../__snapshots__/CLI.test.js.snap.webpack5 | 31 - test/build/basic/basic.test.js | 4 +- .../unknown.test.js.snap.webpack5 | 22 +- .../help.test.js.snap.devServer5.webpack5 | 2923 +---------------- test/help/help.test.js | 398 +-- test/help/set-blocking.js | 3 - 16 files changed, 733 insertions(+), 4895 deletions(-) delete mode 100644 test/api/__snapshots__/CLI.test.js.snap.webpack5 delete mode 100644 test/help/set-blocking.js diff --git a/.cspell.json b/.cspell.json index f6e53dc0040..e5e4557925c 100644 --- a/.cspell.json +++ b/.cspell.json @@ -107,19 +107,14 @@ "watchpack" ], "dictionaries": ["npm", "software-terms"], + "useGitignore": true, "ignorePaths": [ "OPTIONS.md", "SERVE-OPTIONS-v*.md", "**/CHANGELOG.md", - "**/package.json", - "**/dist/**", "**/__snapshots__/**", - "**/*.tsbuildinfo", "**/*.png.tpl", - "**/package-lock.json", - "packages/*/lib/**", - "node_modules", - "coverage", - "*.log" + "**/package.json", + "**/package-lock.json" ] } diff --git a/package-lock.json b/package-lock.json index 66186607d71..73532caf7e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13850,15 +13850,6 @@ ], "license": "BSD-3-Clause" }, - "node_modules/fastest-levenshtein": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", - "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", - "license": "MIT", - "engines": { - "node": ">= 4.9.1" - } - }, "node_modules/fastq": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", @@ -21852,6 +21843,7 @@ "dev": true, "hasInstallScript": true, "license": "MIT", + "peer": true, "dependencies": { "@napi-rs/wasm-runtime": "0.2.4", "@yarnpkg/lockfile": "^1.1.0", @@ -28949,7 +28941,6 @@ "commander": "^12.1.0", "cross-spawn": "^7.0.6", "envinfo": "^7.14.0", - "fastest-levenshtein": "^1.0.12", "import-local": "^3.0.2", "interpret": "^3.1.1", "rechoir": "^0.8.0", diff --git a/packages/configtest/src/index.ts b/packages/configtest/src/index.ts index 67002e7205f..b075e95aec0 100644 --- a/packages/configtest/src/index.ts +++ b/packages/configtest/src/index.ts @@ -4,16 +4,12 @@ const WEBPACK_PACKAGE = process.env.WEBPACK_PACKAGE || "webpack"; class ConfigTestCommand { async apply(cli: IWebpackCLI): Promise { - await cli.makeCommand( - { - name: "configtest [config-path]", - alias: "t", - description: "Validate a webpack configuration.", - pkg: "@webpack-cli/configtest", - dependencies: [WEBPACK_PACKAGE], - }, - [], - async (configPath: string | undefined): Promise => { + await cli.makeCommand({ + name: "configtest [config-path]", + alias: ["t"], + description: "Validate a webpack configuration.", + dependencies: [WEBPACK_PACKAGE], + async action(configPath: string | undefined): Promise { cli.webpack = await cli.loadWebpack(); const config = await cli.loadConfig(configPath ? { config: [configPath] } : {}); @@ -56,7 +52,7 @@ class ConfigTestCommand { cli.logger.success("There are no validation errors in the given webpack configuration."); }, - ); + }); } } diff --git a/packages/info/src/index.ts b/packages/info/src/index.ts index cb9c09509ec..dcaed0eed8b 100644 --- a/packages/info/src/index.ts +++ b/packages/info/src/index.ts @@ -2,21 +2,17 @@ import { type IWebpackCLI } from "webpack-cli"; class InfoCommand { async apply(cli: IWebpackCLI): Promise { - await cli.makeCommand( - { - name: "info", - alias: "i", - description: "Outputs information about your system.", - usage: "[options]", - pkg: "@webpack-cli/info", - }, - cli.getInfoOptions(), - async (options: { output: string; additionalPackage: string[] }) => { + await cli.makeCommand({ + name: "info", + alias: ["i", "version", "v"], + description: "Outputs information about your system.", + options: cli.getInfoOptions().flatMap(cli.makeOption.bind(cli)), + async action(options: { output: string; additionalPackage: string[] }) { const info = await cli.getInfoOutput(options); cli.logger.raw(info); }, - ); + }); } } diff --git a/packages/serve/src/index.ts b/packages/serve/src/index.ts index 2639a892d65..3d520008461 100644 --- a/packages/serve/src/index.ts +++ b/packages/serve/src/index.ts @@ -1,5 +1,10 @@ import { type Compiler, type cli } from "webpack"; -import { type IWebpackCLI, type StringsKeys, type WebpackDevServerOptions } from "webpack-cli"; +import { + type IWebpackCLI, + type StringsKeys, + WebpackCLICommandOption, + type WebpackDevServerOptions, +} from "webpack-cli"; const WEBPACK_PACKAGE = process.env.WEBPACK_PACKAGE || "webpack"; const WEBPACK_DEV_SERVER_PACKAGE = process.env.WEBPACK_DEV_SERVER_PACKAGE || "webpack-dev-server"; @@ -7,58 +12,23 @@ const WEBPACK_DEV_SERVER_PACKAGE = process.env.WEBPACK_DEV_SERVER_PACKAGE || "we type Problem = NonNullable>[0]; class ServeCommand { - async apply(cli: IWebpackCLI): Promise { - const loadDevServerOptions = () => { - const devServer = require(WEBPACK_DEV_SERVER_PACKAGE); + async apply(cli: IWebpackCLI, options: WebpackCLICommandOption[]): Promise { + const devServer = require(WEBPACK_DEV_SERVER_PACKAGE); + const devServerFlags = Object.entries( // eslint-disable-next-line @typescript-eslint/no-explicit-any - const options: Record = cli.webpack.cli.getArguments(devServer.schema); - // New options format - // { flag1: {}, flag2: {} } - return Object.keys(options).map((key) => { - options[key].name = key; - - return options[key]; - }); - }; - - await cli.makeCommand( - { - name: "serve [entries...]", - alias: ["server", "s"], - description: "Run the webpack dev server and watch for source file changes while serving.", - usage: "[entries...] [options]", - pkg: "@webpack-cli/serve", - dependencies: [WEBPACK_PACKAGE, WEBPACK_DEV_SERVER_PACKAGE], - }, - async () => { - let devServerFlags = []; - - cli.webpack = await cli.loadWebpack(); - - try { - devServerFlags = loadDevServerOptions(); - } catch (error) { - cli.logger.error( - `You need to install 'webpack-dev-server' for running 'webpack serve'.\n${error}`, - ); - process.exit(2); - } - - const builtInOptions = cli.getBuiltInOptions(); - - return [...builtInOptions, ...devServerFlags]; - }, + cli.webpack.cli.getArguments(devServer.schema) as Record, + ).map(([name, option]) => ({ name, ...option, group: "core", hidden: true })); + + await cli.makeCommand({ + name: "serve [entries...]", + alias: ["server", "s"], + description: "Run the webpack dev server and watch for source file changes while serving.", + options: [...options, ...devServerFlags.flatMap(cli.makeOption.bind(cli))], + dependencies: [WEBPACK_PACKAGE, WEBPACK_DEV_SERVER_PACKAGE], // eslint-disable-next-line @typescript-eslint/no-explicit-any - async (entries: string[], options: any) => { + async action(entries: string[], options: any) { const builtInOptions = cli.getBuiltInOptions(); - let devServerFlags = []; - - try { - devServerFlags = loadDevServerOptions(); - } catch { - // Nothing, to prevent future updates - } // eslint-disable-next-line @typescript-eslint/no-explicit-any const webpackCLIOptions: Record = {}; @@ -243,7 +213,7 @@ class ServeCommand { process.exit(2); } }, - ); + }); } } diff --git a/packages/webpack-cli/package.json b/packages/webpack-cli/package.json index 985648902c9..9bcc396f14f 100644 --- a/packages/webpack-cli/package.json +++ b/packages/webpack-cli/package.json @@ -39,7 +39,6 @@ "commander": "^12.1.0", "cross-spawn": "^7.0.6", "envinfo": "^7.14.0", - "fastest-levenshtein": "^1.0.12", "import-local": "^3.0.2", "interpret": "^3.1.1", "rechoir": "^0.8.0", diff --git a/packages/webpack-cli/src/bootstrap.ts b/packages/webpack-cli/src/bootstrap.ts index e9a3ea3d322..9ee370fe6a2 100644 --- a/packages/webpack-cli/src/bootstrap.ts +++ b/packages/webpack-cli/src/bootstrap.ts @@ -17,3 +17,6 @@ export default runCLI; // TODO remove me in the next major release and use `default` export module.exports = runCLI; + +// @ts-expect-error ... +if (process.env.npm_lifecycle_script === "tsx") runCLI(); diff --git a/packages/webpack-cli/src/types.ts b/packages/webpack-cli/src/types.ts index 67acb7de486..acc203de513 100644 --- a/packages/webpack-cli/src/types.ts +++ b/packages/webpack-cli/src/types.ts @@ -54,12 +54,8 @@ interface IWebpackCLI { tryRequireThenImport(module: ModuleName, handleError: boolean): Promise; getInfoOptions(): WebpackCLIBuiltInOption[]; getInfoOutput(options: { output: string; additionalPackage: string[] }): Promise; - makeCommand( - commandOptions: WebpackCLIOptions, - options: WebpackCLICommandOptions, - action: CommandAction, - ): Promise; - makeOption(command: WebpackCLICommand, option: WebpackCLIBuiltInOption): void; + makeCommand(commandOptions: WebpackCLIOptions): Promise; + makeOption(option: WebpackCLIBuiltInFlag): WebpackCLICommandOption[]; run( args: Parameters[0], parseOptions?: ParseOptions, @@ -80,6 +76,11 @@ interface IWebpackCLI { runWebpack(options: WebpackRunOptions, isWatchCommand: boolean): Promise; } +declare interface WebpackCallback { + (err: null | Error, result?: Stats): void; + (err: null | Error, result?: MultiStats): void; +} + interface WebpackCLIColors extends Colors { isColorSupported: boolean; } @@ -118,18 +119,13 @@ type WebpackCLIMainOption = Pick< interface WebpackCLIOptions extends CommandOptions { name: string; - alias: string | string[]; - description?: string; - usage?: string; + alias: string[]; + description: string; dependencies?: string[]; - pkg?: string; - argsDescription?: Record; + options?: Option[]; + action: CommandAction; } -type WebpackCLICommandOptions = - | WebpackCLIBuiltInOption[] - | (() => Promise); - interface WebpackCLIBuiltInFlag { name: string; alias?: string; @@ -145,18 +141,13 @@ interface WebpackCLIBuiltInFlag { describe?: string; negatedDescription?: string; defaultValue?: string; - helpLevel: "minimum" | "verbose"; + hidden: boolean; } interface WebpackCLIBuiltInOption extends WebpackCLIBuiltInFlag { - hidden?: boolean; group?: "core"; } -type WebpackCLIExternalCommandInfo = Pick & { - pkg: string; -}; - /** * Webpack dev server */ @@ -254,7 +245,7 @@ type PotentialPromise = T | Promise; type ModuleName = string; type Path = string; // eslint-disable-next-line @typescript-eslint/no-explicit-any -type LogHandler = (value: any) => void; +type LogHandler = (value: any, raw?: boolean) => void; type StringFormatter = (value: string) => string; // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -313,7 +304,6 @@ export { type CommandAction, type CommanderOption, type DynamicImport, - type EnumValue, type FileSystemCacheOptions, type IWebpackCLI, type ImportLoaderError, @@ -335,9 +325,7 @@ export { type WebpackCLIColors, type WebpackCLICommand, type WebpackCLICommandOption, - type WebpackCLICommandOptions, type WebpackCLIConfig, - type WebpackCLIExternalCommandInfo, type WebpackCLILogger, type WebpackCLIMainOption, type WebpackCLIOptions, diff --git a/packages/webpack-cli/src/webpack-cli.ts b/packages/webpack-cli/src/webpack-cli.ts index ae26dff3317..6de256a360b 100644 --- a/packages/webpack-cli/src/webpack-cli.ts +++ b/packages/webpack-cli/src/webpack-cli.ts @@ -1,5 +1,5 @@ import { type stringifyChunked } from "@discoveryjs/json-ext"; -import { type Help, type ParseOptions } from "commander"; +import { type ParseOptions } from "commander"; import { type Compiler, type Configuration, @@ -19,9 +19,7 @@ import { type BasicPrimitive, type CLIPluginOptions, type CallableWebpackConfiguration, - type CommandAction, type DynamicImport, - type EnumValue, type FileSystemCacheOptions, type IWebpackCLI, type ImportLoaderError, @@ -44,9 +42,7 @@ import { type WebpackCLIColors, type WebpackCLICommand, type WebpackCLICommandOption, - type WebpackCLICommandOptions, type WebpackCLIConfig, - type WebpackCLIExternalCommandInfo, type WebpackCLILogger, type WebpackCLIMainOption, type WebpackCLIOptions, @@ -104,13 +100,20 @@ class WebpackCLI implements IWebpackCLI { this.program = program; this.program.name("webpack"); this.program.configureOutput({ - writeErr: (str) => { - this.logger.error(str); - }, + writeErr: (str) => this.logger.error(str, true), outputError: (str, write) => { - write(`Error: ${this.capitalizeFirstLetter(str.replace(/^error:/, "").trim())}`); + write(`Error: ${this.capitalizeFirstLetter(str.replace(/^error:\s*/, ""))}`); }, }); + + // The CLI exits with code '2' instead of code '1' + this.program.exitOverride(({ exitCode }) => { + if (exitCode === 1) { + process.exit(2); + } + }); + + this.program.showHelpAfterError("Run 'webpack --help' to see available commands and options"); } isMultipleConfiguration( @@ -166,12 +169,17 @@ class WebpackCLI implements IWebpackCLI { } getLogger(): WebpackCLILogger { + const log = (method: "error" | "warn" | "info" | "log", val: string, raw?: boolean) => + raw + ? process[method === "error" ? "stderr" : "stdout"].write(`[webpack-cli] ${val}`) + : console[method](`[webpack-cli] ${val}`); + return { - error: (val) => console.error(`[webpack-cli] ${this.colors.red(util.format(val))}`), - warn: (val) => console.warn(`[webpack-cli] ${this.colors.yellow(val)}`), - info: (val) => console.info(`[webpack-cli] ${this.colors.cyan(val)}`), - success: (val) => console.log(`[webpack-cli] ${this.colors.green(val)}`), - log: (val) => console.log(`[webpack-cli] ${val}`), + error: (val, raw) => log("error", this.colors.red(util.format(val)), raw), + warn: (val, raw) => log("warn", this.colors.red(util.format(val)), raw), + info: (val, raw) => log("info", this.colors.red(util.format(val)), raw), + success: (val, raw) => log("log", this.colors.red(util.format(val)), raw), + log: (val, raw) => log("error", this.colors.red(util.format(val)), raw), raw: (val) => console.log(val), }; } @@ -478,7 +486,7 @@ class WebpackCLI implements IWebpackCLI { }, ], description: "To get the output in a specified format ( accept json or markdown )", - helpLevel: "minimum", + hidden: true, }, { name: "additional-package", @@ -486,12 +494,12 @@ class WebpackCLI implements IWebpackCLI { configs: [{ type: "string" }], multiple: true, description: "Adds additional packages to the output", - helpLevel: "minimum", + hidden: true, }, ]; } - async getInfoOutput(options: { output: string; additionalPackage: string[] }): Promise { + async getInfoOutput(options: { output?: string; additionalPackage?: string[] }): Promise { let { output } = options; const envinfoConfig: Record = {}; @@ -531,7 +539,7 @@ class WebpackCLI implements IWebpackCLI { npmGlobalPackages: ["webpack", "webpack-cli", "webpack-dev-server"], }; - let defaultPackages: string[] = ["webpack", "loader", "@webpack-cli/"]; + let defaultPackages: string[] = ["webpack", "loader"]; if (typeof options.additionalPackage !== "undefined") { defaultPackages = [...defaultPackages, ...options.additionalPackage]; @@ -549,55 +557,27 @@ class WebpackCLI implements IWebpackCLI { return info; } - async makeCommand( - commandOptions: WebpackCLIOptions, - options: WebpackCLICommandOptions, - action: CommandAction, - ): Promise { - const alreadyLoaded = this.program.commands.find( - (command) => - command.name() === commandOptions.name.split(" ")[0] || - command.aliases().includes(commandOptions.alias as string), - ); - - if (alreadyLoaded) { - return; - } - + async makeCommand(commandOptions: WebpackCLIOptions): Promise { const command = this.program.command(commandOptions.name, { hidden: commandOptions.hidden, isDefault: commandOptions.isDefault, }) as WebpackCLICommand; - if (commandOptions.description) { - command.description(commandOptions.description, commandOptions.argsDescription!); - } + command.description(commandOptions.description); + command.aliases(commandOptions.alias); - if (commandOptions.usage) { - command.usage(commandOptions.usage); - } - - if (Array.isArray(commandOptions.alias)) { - command.aliases(commandOptions.alias); - } else { - command.alias(commandOptions.alias); + if (commandOptions.options) { + for (const option of commandOptions.options) { + command.addOption(option); + } } - command.pkg = commandOptions.pkg || "webpack-cli"; - - const { forHelp } = this.program; - - let allDependenciesInstalled = true; - if (commandOptions.dependencies && commandOptions.dependencies.length > 0) { for (const dependency of commandOptions.dependencies) { const isPkgExist = this.checkPackageExists(dependency); if (isPkgExist) { continue; - } else if (!isPkgExist && forHelp) { - allDependenciesInstalled = false; - continue; } let skipInstallation = false; @@ -628,58 +608,34 @@ class WebpackCLI implements IWebpackCLI { } } - if (options) { - if (typeof options === "function") { - if (forHelp && !allDependenciesInstalled && commandOptions.dependencies) { - command.description( - `${ - commandOptions.description - } To see all available options you need to install ${commandOptions.dependencies - .map((dependency) => `'${dependency}'`) - .join(", ")}.`, - ); - options = []; - } else { - options = await options(); - } - } - - for (const option of options) { - this.makeOption(command, option); - } - } - - command.action(action); + command.action(commandOptions.action); return command; } - makeOption(command: WebpackCLICommand, option: WebpackCLIBuiltInOption) { - let mainOption: WebpackCLIMainOption; - let negativeOption; + makeOption(option: WebpackCLIBuiltInOption): WebpackCLICommandOption[] { + const options: WebpackCLICommandOption[] = []; const flagsWithAlias = ["devtool", "output-path", "target", "watch", "extends"]; if (flagsWithAlias.includes(option.name)) { [option.alias] = option.name; } - if (option.configs) { - let needNegativeOption = false; - let negatedDescription; - const mainOptionType: WebpackCLIMainOption["type"] = new Set(); + const mainOptionType: WebpackCLIMainOption["type"] = new Set(); + let needNegativeOption = false; + let negatedDescription: string | undefined; + // Determine option types and negative option needs + if (option.configs) { for (const config of option.configs) { switch (config.type) { case "reset": - mainOptionType.add(Boolean); - break; case "boolean": - if (!needNegativeOption) { + mainOptionType.add(Boolean); + if (!needNegativeOption && config.type === "boolean") { needNegativeOption = true; negatedDescription = config.negatedDescription; } - - mainOptionType.add(Boolean); break; case "number": mainOptionType.add(Number); @@ -691,188 +647,156 @@ class WebpackCLI implements IWebpackCLI { break; case "enum": { let hasFalseEnum = false; - for (const value of config.values || []) { - switch (typeof value) { - case "string": - mainOptionType.add(String); - break; - case "number": - mainOptionType.add(Number); - break; - case "boolean": - if (!hasFalseEnum && value === false) { - hasFalseEnum = true; - break; - } - + if (typeof value === "string") { + mainOptionType.add(String); + } else if (typeof value === "number") { + mainOptionType.add(Number); + } else if (typeof value === "boolean") { + if (value === false && !hasFalseEnum) { + hasFalseEnum = true; + } else { mainOptionType.add(Boolean); - break; + } } } - - if (!needNegativeOption) { - needNegativeOption = hasFalseEnum; + if (!needNegativeOption && hasFalseEnum) { + needNegativeOption = true; negatedDescription = config.negatedDescription; } + break; } } } - - mainOption = { - flags: option.alias ? `-${option.alias}, --${option.name}` : `--${option.name}`, - valueName: option.valueName || "value", - description: option.description || "", - type: mainOptionType, - multiple: option.multiple, - defaultValue: option.defaultValue, - }; - - if (needNegativeOption) { - negativeOption = { - flags: `--no-${option.name}`, - description: - negatedDescription || option.negatedDescription || `Negative '${option.name}' option.`, - }; - } } else { - mainOption = { - flags: option.alias ? `-${option.alias}, --${option.name}` : `--${option.name}`, - valueName: option.valueName || "value", - description: option.description || "", - type: option.type - ? new Set(Array.isArray(option.type) ? option.type : [option.type]) - : new Set([Boolean]), - multiple: option.multiple, - defaultValue: option.defaultValue, - }; - - if (option.negative) { - negativeOption = { - flags: `--no-${option.name}`, - description: option.negatedDescription || `Negative '${option.name}' option.`, - }; - } - } - - if (mainOption.type.size > 1 && mainOption.type.has(Boolean)) { - mainOption.flags = `${mainOption.flags} [${mainOption.valueName || "value"}${ - mainOption.multiple ? "..." : "" - }]`; - } else if (mainOption.type.size > 0 && !mainOption.type.has(Boolean)) { - mainOption.flags = `${mainOption.flags} <${mainOption.valueName || "value"}${ - mainOption.multiple ? "..." : "" - }>`; + const types = option.type + ? Array.isArray(option.type) + ? option.type + : [option.type] + : [Boolean]; + for (const type of types) mainOptionType.add(type); + needNegativeOption = option.negative || false; + negatedDescription = option.negatedDescription; } - if (mainOption.type.size === 1) { - if (mainOption.type.has(Number)) { - let skipDefault = true; - - const optionForCommand: WebpackCLICommandOption = new Option( - mainOption.flags, - mainOption.description, - ) - .argParser((value: string, prev = []) => { - if (mainOption.defaultValue && mainOption.multiple && skipDefault) { - prev = []; - skipDefault = false; - } - - return mainOption.multiple ? [...prev, Number(value)] : Number(value); - }) - .default(mainOption.defaultValue); - - optionForCommand.helpLevel = option.helpLevel; - - command.addOption(optionForCommand); - } else if (mainOption.type.has(String)) { - let skipDefault = true; + // Build main option flags + const baseFlags = option.alias ? `-${option.alias}, --${option.name}` : `--${option.name}`; + const valueName = option.valueName || "value"; + const multipleIndicator = option.multiple ? "..." : ""; - const optionForCommand: WebpackCLICommandOption = new Option( - mainOption.flags, - mainOption.description, - ) - .argParser((value: string, prev = []) => { - if (mainOption.defaultValue && mainOption.multiple && skipDefault) { - prev = []; - skipDefault = false; - } + let flags = baseFlags; + if (mainOptionType.size > 1 && mainOptionType.has(Boolean)) { + flags = `${baseFlags} [${valueName}${multipleIndicator}]`; + } else if (mainOptionType.size > 0 && !mainOptionType.has(Boolean)) { + flags = `${baseFlags} <${valueName}${multipleIndicator}>`; + } - return mainOption.multiple ? [...prev, value] : value; - }) - .default(mainOption.defaultValue); + const description = option.description || ""; - optionForCommand.helpLevel = option.helpLevel; + // Create main option + let mainOptionCommand: WebpackCLICommandOption; - command.addOption(optionForCommand); - } else if (mainOption.type.has(Boolean)) { - const optionForCommand = new Option(mainOption.flags, mainOption.description).default( - mainOption.defaultValue, - ); - - optionForCommand.helpLevel = option.helpLevel; + if (mainOptionType.size === 1) { + mainOptionCommand = this.createSingleTypeOption( + flags, + description, + mainOptionType, + option.defaultValue, + option.multiple, + ); + } else if (mainOptionType.size > 1) { + mainOptionCommand = this.createMultiTypeOption( + flags, + description, + mainOptionType, + option.defaultValue, + option.multiple, + ); + } else { + mainOptionCommand = new Option(flags, description).default(option.defaultValue); + } - command.addOption(optionForCommand); - } else { - const optionForCommand = new Option(mainOption.flags, mainOption.description) - .argParser([...mainOption.type][0]) - .default(mainOption.defaultValue); + mainOptionCommand.hidden = option.hidden; + options.push(mainOptionCommand); + + // Create negative option if needed + if (needNegativeOption) { + const negativeFlags = `--no-${option.name}`; + const negativeDesc = + negatedDescription || option.negatedDescription || `Negative '${option.name}' option. `; + const negativeOptionCommand = new Option(negativeFlags, negativeDesc); + negativeOptionCommand.hidden = option.hidden; + options.push(negativeOptionCommand); + } - optionForCommand.helpLevel = option.helpLevel; + return options; + } - command.addOption(optionForCommand); - } - } else if (mainOption.type.size > 1) { - let skipDefault = true; - - const optionForCommand = new Option( - mainOption.flags, - mainOption.description, - mainOption.defaultValue, - ) + private createSingleTypeOption( + flags: string, + description: string, + types: WebpackCLIMainOption["type"], + defaultValue: unknown, + multiple?: boolean, + ): WebpackCLICommandOption { + let skipDefault = true; + + if (types.has(Number)) { + return new Option(flags, description) .argParser((value: string, prev = []) => { - if (mainOption.defaultValue && mainOption.multiple && skipDefault) { + if (defaultValue && multiple && skipDefault) { prev = []; skipDefault = false; } - - if (mainOption.type.has(Number)) { - const numberValue = Number(value); - - if (!Number.isNaN(numberValue)) { - return mainOption.multiple ? [...prev, numberValue] : numberValue; - } - } - - if (mainOption.type.has(String)) { - return mainOption.multiple ? [...prev, value] : value; + return multiple ? [...prev, Number(value)] : Number(value); + }) + .default(defaultValue); + } else if (types.has(String)) { + return new Option(flags, description) + .argParser((value: string, prev = []) => { + if (defaultValue && multiple && skipDefault) { + prev = []; + skipDefault = false; } - - return value; + return multiple ? [...prev, value] : value; }) - .default(mainOption.defaultValue); - - optionForCommand.helpLevel = option.helpLevel; - - command.addOption(optionForCommand); - } else if (mainOption.type.size === 0 && negativeOption) { - const optionForCommand = new Option(mainOption.flags, mainOption.description); - - // Hide stub option - optionForCommand.hideHelp(); - optionForCommand.helpLevel = option.helpLevel; - - command.addOption(optionForCommand); + .default(defaultValue); + } else if (types.has(Boolean)) { + return new Option(flags, description).default(defaultValue); } + return new Option(flags, description).argParser([...types][0]).default(defaultValue); + } - if (negativeOption) { - const optionForCommand = new Option(negativeOption.flags, negativeOption.description); + private createMultiTypeOption( + flags: string, + description: string, + types: WebpackCLIMainOption["type"], + defaultValue: unknown, + multiple?: boolean, + ): WebpackCLICommandOption { + let skipDefault = true; + + return new Option(flags, description) + .argParser((value: string, prev = []) => { + if (defaultValue && multiple && skipDefault) { + prev = []; + skipDefault = false; + } - optionForCommand.helpLevel = option.helpLevel; + if (types.has(Number)) { + const numberValue = Number(value); + if (!Number.isNaN(numberValue)) { + return multiple ? [...prev, numberValue] : numberValue; + } + } - command.addOption(optionForCommand); - } + if (types.has(String)) { + return multiple ? [...prev, value] : value; + } + + return value; + }) + .default(defaultValue); } getBuiltInOptions(): WebpackCLIBuiltInOption[] { @@ -894,7 +818,7 @@ class WebpackCLI implements IWebpackCLI { valueName: "pathToConfigFile", description: 'Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js".', - helpLevel: "minimum", + hidden: true, }, { name: "config-name", @@ -907,7 +831,7 @@ class WebpackCLI implements IWebpackCLI { valueName: "name", description: "Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations.", - helpLevel: "minimum", + hidden: true, }, { name: "merge", @@ -919,7 +843,7 @@ class WebpackCLI implements IWebpackCLI { }, ], description: "Merge two or more configurations using 'webpack-merge'.", - helpLevel: "minimum", + hidden: true, }, { name: "disable-interpret", @@ -930,7 +854,7 @@ class WebpackCLI implements IWebpackCLI { }, ], description: "Disable interpret for loading the config file.", - helpLevel: "minimum", + hidden: true, }, // Complex configs { @@ -975,7 +899,7 @@ class WebpackCLI implements IWebpackCLI { multiple: true, description: 'Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval".', - helpLevel: "minimum", + hidden: true, }, { name: "node-env", @@ -987,7 +911,7 @@ class WebpackCLI implements IWebpackCLI { multiple: false, description: "Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead)", - helpLevel: "minimum", + hidden: true, }, { name: "config-node-env", @@ -999,7 +923,7 @@ class WebpackCLI implements IWebpackCLI { multiple: false, description: "Sets process.env.NODE_ENV to the specified value for access within the configuration.", - helpLevel: "minimum", + hidden: true, }, // Adding more plugins @@ -1013,7 +937,7 @@ class WebpackCLI implements IWebpackCLI { ], multiple: false, description: "It invokes webpack-bundle-analyzer plugin to get bundle information.", - helpLevel: "minimum", + hidden: true, }, { name: "progress", @@ -1027,7 +951,7 @@ class WebpackCLI implements IWebpackCLI { }, ], description: "Print compilation progress during build.", - helpLevel: "minimum", + hidden: true, }, // Output options @@ -1045,7 +969,7 @@ class WebpackCLI implements IWebpackCLI { alias: "j", valueName: "pathToJsonFile", description: "Prints result as JSON or store it in a file.", - helpLevel: "minimum", + hidden: true, }, { name: "fail-on-warnings", @@ -1056,7 +980,7 @@ class WebpackCLI implements IWebpackCLI { }, ], description: "Stop webpack-cli process with non-zero exit code on warnings from webpack.", - helpLevel: "minimum", + hidden: true, }, ]; @@ -1076,18 +1000,19 @@ class WebpackCLI implements IWebpackCLI { // Extract all the flags being exported from core. // A list of cli flags generated by core can be found here https://github.com/webpack/webpack/blob/main/test/__snapshots__/Cli.basictest.js.snap - const options = [ - ...builtInFlags, - ...Object.entries(this.webpack.cli.getArguments()).map( + let coreOptions: WebpackCLIBuiltInOption[] = []; + if (this.webpack) { + coreOptions = Object.entries(this.webpack.cli.getArguments()).map( ([name, meta]) => ({ ...meta, name, description: meta.description, group: "core", - helpLevel: minimumHelpFlags.includes(name) ? "minimum" : "verbose", + hidden: !minimumHelpFlags.includes(name), }), - ), - ]; + ); + } + const options = [...builtInFlags, ...coreOptions]; this.builtInOptionsCache = options; @@ -1098,693 +1023,115 @@ class WebpackCLI implements IWebpackCLI { return this.tryRequireThenImport(WEBPACK_PACKAGE, handleError); } - async run(args: Parameters[0], parseOptions: ParseOptions) { - // Default `--color` and `--no-color` options + async run(args?: Parameters[0], parseOptions?: ParseOptions) { // eslint-disable-next-line @typescript-eslint/no-this-alias - const cli: IWebpackCLI = this; + const cli = this; + + // Load webpack early for getBuiltInOptions to access cli.getArguments() + this.webpack = await this.loadWebpack(); + + const options = this.getBuiltInOptions().flatMap((opt) => this.makeOption(opt)); - // Built-in internal commands - const buildCommandOptions = { + await this.makeCommand({ name: "build [entries...]", alias: ["bundle", "b"], description: "Run webpack (default command, can be omitted).", - usage: "[entries...] [options]", - dependencies: [WEBPACK_PACKAGE], - }; - const watchCommandOptions = { - name: "watch [entries...]", - alias: "w", - description: "Run webpack and watch for files changes.", - usage: "[entries...] [options]", dependencies: [WEBPACK_PACKAGE], - }; - const versionCommandOptions = { - name: "version", - alias: "v", - usage: "[options]", - description: - "Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.", - }; - const helpCommandOptions = { - name: "help [command] [option]", - alias: "h", - description: "Display help for commands and options.", - }; - // Built-in external commands - const externalBuiltInCommandsInfo: WebpackCLIExternalCommandInfo[] = [ - { - name: "serve [entries...]", - alias: ["server", "s"], - pkg: "@webpack-cli/serve", - }, - { - name: "info", - alias: "i", - pkg: "@webpack-cli/info", - }, - { - name: "configtest [config-path]", - alias: "t", - pkg: "@webpack-cli/configtest", - }, - ]; - - const knownCommands = [ - buildCommandOptions, - watchCommandOptions, - versionCommandOptions, - helpCommandOptions, - ...externalBuiltInCommandsInfo, - ]; - const getCommandName = (name: string) => name.split(" ")[0]; - const isKnownCommand = (name: string) => - knownCommands.find( - (command) => - getCommandName(command.name) === name || - (Array.isArray(command.alias) ? command.alias.includes(name) : command.alias === name), - ); - const isCommand = (input: string, commandOptions: WebpackCLIOptions) => { - const longName = getCommandName(commandOptions.name); - - if (input === longName) { - return true; - } - - if (commandOptions.alias) { - if (Array.isArray(commandOptions.alias)) { - return commandOptions.alias.includes(input); - } - return commandOptions.alias === input; - } - - return false; - }; - const findCommandByName = (name: string) => - this.program.commands.find( - (command) => name === command.name() || command.aliases().includes(name), - ); - const isOption = (value: string): boolean => value.startsWith("-"); - const isGlobalOption = (value: string) => - value === "--color" || - value === "--no-color" || - value === "-v" || - value === "--version" || - value === "-h" || - value === "--help"; - - const loadCommandByName = async ( - commandName: WebpackCLIExternalCommandInfo["name"], - allowToInstall = false, - ) => { - const isBuildCommandUsed = isCommand(commandName, buildCommandOptions); - const isWatchCommandUsed = isCommand(commandName, watchCommandOptions); - - if (isBuildCommandUsed || isWatchCommandUsed) { - await this.makeCommand( - isBuildCommandUsed ? buildCommandOptions : watchCommandOptions, - async () => { - this.webpack = await this.loadWebpack(); - - return this.getBuiltInOptions(); - }, - async (entries, options) => { - if (entries.length > 0) { - options.entry = [...entries, ...(options.entry || [])]; - } - - await this.runWebpack(options, isWatchCommandUsed); - }, - ); - } else if (isCommand(commandName, helpCommandOptions)) { - this.makeCommand(helpCommandOptions, [], () => { - // Stub for the `help` command - }); - } else if (isCommand(commandName, versionCommandOptions)) { - // Stub for the `version` command - this.makeCommand( - versionCommandOptions, - this.getInfoOptions(), - async (options: { output: string; additionalPackage: string[] }) => { - const info = await cli.getInfoOutput(options); - - cli.logger.raw(info); - }, - ); - } else { - const builtInExternalCommandInfo = externalBuiltInCommandsInfo.find( - (externalBuiltInCommandInfo) => - getCommandName(externalBuiltInCommandInfo.name) === commandName || - (Array.isArray(externalBuiltInCommandInfo.alias) - ? externalBuiltInCommandInfo.alias.includes(commandName) - : externalBuiltInCommandInfo.alias === commandName), - ); - - let pkg: string; - - if (builtInExternalCommandInfo) { - ({ pkg } = builtInExternalCommandInfo); - } else { - pkg = commandName; + isDefault: true, + options, + async action(this: WebpackCLICommand, entries, options) { + if ( + this.parent!.args.length > 0 && + this.parent!.args[0] === this.args[0] && + !fs.existsSync(this.args[0]) + ) { + // If we are running as default _and_ an entry cannot be found, + // we should suggest alternative commands to the user. + // @ts-expect-error It's a private method + this.parent!.unknownCommand(); } - if (pkg !== "webpack-cli" && !this.checkPackageExists(pkg)) { - if (!allowToInstall) { - return; - } - - pkg = await this.doInstall(pkg, { - preMessage: () => { - this.logger.error( - `For using this command you need to install: '${this.colors.green(pkg)}' package.`, - ); - }, - }); + if (entries.length > 0) { + options.entry = [...entries, ...(options.entry || [])]; } - let loadedCommand; - - try { - loadedCommand = await this.tryRequireThenImport void>>(pkg, false); - } catch { - // Ignore, command is not installed + await cli.runWebpack(options, false); + }, + }); - return; + await this.makeCommand({ + name: "watch [entries...]", + alias: ["w"], + description: "Run webpack and watch for files changes.", + dependencies: [WEBPACK_PACKAGE], + options, + async action(entries, options) { + if (entries.length > 0) { + options.entry = [...entries, ...(options.entry || [])]; } - let command; - - try { - // eslint-disable-next-line new-cap - command = new loadedCommand(); + await cli.runWebpack(options, true); + }, + }); - await command.apply(this); - } catch (error) { - this.logger.error(`Unable to load '${pkg}' command`); - this.logger.error(error); - process.exit(2); - } - } - }; + for (const commandName of ["configtest", "serve", "info"]) { + const LoadedCommand = await this.tryRequireThenImport< + Instantiable<{ + apply: (cli: WebpackCLI, options: WebpackCLICommandOption[]) => Promise; + }> + >(`@webpack-cli/${commandName}`, false); - // Register own exit - this.program.exitOverride(async (error) => { - if (error.exitCode === 0) { - process.exit(0); - } + try { + const command = new LoadedCommand(); - if (error.code === "executeSubCommandAsync") { + await command.apply(this, options); + } catch (error) { + this.logger.error(`Unable to load '@webpack-cli/${commandName}' command`); + this.logger.error(error); process.exit(2); } + } - if (error.code === "commander.help") { - process.exit(0); - } - - if (error.code === "commander.unknownOption") { - let name = error.message.match(/'(.+)'/) as string | null; - - if (name) { - name = name[1].slice(2); - - if (name.includes("=")) { - [name] = name.split("="); - } - - const { operands } = this.program.parseOptions(this.program.args); - const operand = - typeof operands[0] !== "undefined" - ? operands[0] - : getCommandName(buildCommandOptions.name); - - if (operand) { - const command = findCommandByName(operand); - - if (!command) { - this.logger.error(`Can't find and load command '${operand}'`); - this.logger.error("Run 'webpack --help' to see available commands and options"); - process.exit(2); - } - - const levenshtein = require("fastest-levenshtein"); - - for (const option of (command as WebpackCLICommand).options) { - if (!option.hidden && levenshtein.distance(name, option.long?.slice(2)) < 3) { - this.logger.error(`Did you mean '--${option.name()}'?`); - } - } - } + this.program + .option("-v, --version", "Outputs information about your system.") + .option("--help [verbosity]", "Display help for command") + .option("--color", "Enable colors on console.") + .option("--no-color", "Disable colors on console.") + .hook("preSubcommand", async (thisCommand) => { + const { color } = thisCommand.opts(); + + if (color !== undefined) { + cli.isColorSupportChanged = color; + cli.colors = cli.createColors(color); } - } - - // Codes: - // - commander.unknownCommand - // - commander.missingArgument - // - commander.missingMandatoryOptionValue - // - commander.optionMissingArgument - - this.logger.error("Run 'webpack --help' to see available commands and options"); - process.exit(2); - }); - - this.program.option("--color", "Enable colors on console."); - this.program.on("option:color", function color(this: WebpackCLICommand) { - const { color } = this.opts(); + }) + .hook("preAction", async (thisCommand, actionCommand) => { + const { help, version } = thisCommand.opts(); - cli.isColorSupportChanged = color; - cli.colors = cli.createColors(color); - }); - this.program.option("--no-color", "Disable colors on console."); - this.program.on("option:no-color", function noColor(this: WebpackCLICommand) { - const { color } = this.opts(); - - cli.isColorSupportChanged = color; - cli.colors = cli.createColors(color); - }); - - this.program.option( - "-v, --version", - "Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.", - ); - - // webpack-cli has it's own logic for showing suggestions - this.program.showSuggestionAfterError(false); - - const outputHelp = async ( - options: string[], - isVerbose: boolean, - isHelpCommandSyntax: boolean, - program: WebpackCLICommand, - ) => { - const { bold } = this.colors; - const outputIncorrectUsageOfHelp = () => { - this.logger.error("Incorrect use of help"); - this.logger.error( - "Please use: 'webpack help [command] [option]' | 'webpack [command] --help'", - ); - this.logger.error("Run 'webpack --help' to see available commands and options"); - process.exit(2); - }; - - const isGlobalHelp = options.length === 0; - const isCommandHelp = options.length === 1 && !isOption(options[0]); - - if (isGlobalHelp || isCommandHelp) { - program.configureHelp({ - sortSubcommands: true, - // Support multiple aliases - commandUsage: (command: WebpackCLICommand) => { - let parentCmdNames = ""; - - for (let parentCmd = command.parent; parentCmd; parentCmd = parentCmd.parent) { - parentCmdNames = `${parentCmd.name()} ${parentCmdNames}`; - } - - if (isGlobalHelp) { - return `${parentCmdNames}${command.usage()}\n${bold( - "Alternative usage to run commands:", - )} ${parentCmdNames}[command] [options]`; - } - - return `${parentCmdNames}${command.name()}|${command - .aliases() - .join("|")} ${command.usage()}`; - }, - // Support multiple aliases - subcommandTerm: (command: WebpackCLICommand) => { - const humanReadableArgumentName = (argument: WebpackCLICommandOption) => { - const nameOutput = argument.name() + (argument.variadic ? "..." : ""); - - return argument.required ? `<${nameOutput}>` : `[${nameOutput}]`; - }; - const args = command._args - .map((arg: WebpackCLICommandOption) => humanReadableArgumentName(arg)) - .join(" "); - - return `${command.name()}|${command.aliases().join("|")}${args ? ` ${args}` : ""}${ - command.options.length > 0 ? " [options]" : "" - }`; - }, - visibleOptions: function visibleOptions( - command: WebpackCLICommand, - ): WebpackCLICommandOption[] { - return command.options.filter((option: WebpackCLICommandOption) => { - if (option.hidden) { - return false; - } - - // Hide `--watch` option when developer use `webpack watch --help` - if ( - (options[0] === "w" || options[0] === "watch") && - (option.name() === "watch" || option.name() === "no-watch") - ) { - return false; - } - - switch (option.helpLevel) { - case "verbose": - return isVerbose; - case "minimum": - default: - return true; - } - }); - }, - padWidth(command: WebpackCLICommand, helper: Help) { - return Math.max( - helper.longestArgumentTermLength(command, helper), - helper.longestOptionTermLength(command, helper), - // For global options - helper.longestOptionTermLength(program, helper), - helper.longestSubcommandTermLength(isGlobalHelp ? program : command, helper), - ); - }, - formatHelp: (command: WebpackCLICommand, helper: Help) => { - const termWidth = helper.padWidth(command, helper); - const helpWidth = - helper.helpWidth || (process.env.WEBPACK_CLI_HELP_WIDTH as unknown as number) || 80; - const itemIndentWidth = 2; - const itemSeparatorWidth = 2; // between term and description - - const formatItem = (term: string, description: string) => { - if (description) { - const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`; - - return helper.wrap( - fullText, - helpWidth - itemIndentWidth, - termWidth + itemSeparatorWidth, - ); - } - - return term; - }; - - const formatList = (textArray: string[]) => - textArray.join("\n").replaceAll(/^/gm, " ".repeat(itemIndentWidth)); - - // Usage - let output = [`${bold("Usage:")} ${helper.commandUsage(command)}`, ""]; - - // Description - const commandDescription = isGlobalHelp - ? "The build tool for modern web applications." - : helper.commandDescription(command); - - if (commandDescription.length > 0) { - output = [...output, commandDescription, ""]; - } - - // Arguments - const argumentList = helper - .visibleArguments(command) - .map((argument) => formatItem(argument.name(), argument.description)); - - if (argumentList.length > 0) { - output = [...output, bold("Arguments:"), formatList(argumentList), ""]; - } - - // Options - const optionList = helper - .visibleOptions(command) - .map((option) => - formatItem(helper.optionTerm(option), helper.optionDescription(option)), - ); - - if (optionList.length > 0) { - output = [...output, bold("Options:"), formatList(optionList), ""]; - } - - // Global options - const globalOptionList = program.options.map((option: WebpackCLICommandOption) => - formatItem(helper.optionTerm(option), helper.optionDescription(option)), - ); - - if (globalOptionList.length > 0) { - output = [...output, bold("Global options:"), formatList(globalOptionList), ""]; - } - - // Commands - const commandList = helper - .visibleCommands(isGlobalHelp ? program : command) - .map((command) => - formatItem(helper.subcommandTerm(command), helper.subcommandDescription(command)), - ); - - if (commandList.length > 0) { - output = [...output, bold("Commands:"), formatList(commandList), ""]; - } - - return output.join("\n"); - }, - }); - - if (isGlobalHelp) { - await Promise.all( - knownCommands.map((knownCommand) => - loadCommandByName(getCommandName(knownCommand.name)), - ), - ); - - const buildCommand = findCommandByName(getCommandName(buildCommandOptions.name)); - - if (buildCommand) { - this.logger.raw(buildCommand.helpInformation()); - } - } else { - const [name] = options; - - await loadCommandByName(name); - - const command = findCommandByName(name); - - if (!command) { - const builtInCommandUsed = externalBuiltInCommandsInfo.find( - (command) => command.name.includes(name) || name === command.alias, - ); - if (typeof builtInCommandUsed !== "undefined") { - this.logger.error( - `For using '${name}' command you need to install '${builtInCommandUsed.pkg}' package.`, - ); - } else { - this.logger.error(`Can't find and load command '${name}'`); - this.logger.error("Run 'webpack --help' to see available commands and options."); - } + if (help) { + if (typeof help !== "boolean" && help !== "verbose") { + cli.logger.error("Unknown value for '--help' option, please use '--help=verbose'"); process.exit(2); } - this.logger.raw(command.helpInformation()); - } - } else if (isHelpCommandSyntax) { - let isCommandSpecified = false; - let commandName = getCommandName(buildCommandOptions.name); - let optionName = ""; - - if (options.length === 1) { - [optionName] = options; - } else if (options.length === 2) { - isCommandSpecified = true; - [commandName, optionName] = options; - - if (isOption(commandName)) { - outputIncorrectUsageOfHelp(); - } - } else { - outputIncorrectUsageOfHelp(); - } - - await loadCommandByName(commandName); - - const command = isGlobalOption(optionName) ? program : findCommandByName(commandName); - - if (!command) { - this.logger.error(`Can't find and load command '${commandName}'`); - this.logger.error("Run 'webpack --help' to see available commands and options"); - process.exit(2); - } - - const option = (command as WebpackCLICommand).options.find( - (option) => option.short === optionName || option.long === optionName, - ); - - if (!option) { - this.logger.error(`Unknown option '${optionName}'`); - this.logger.error("Run 'webpack --help' to see available commands and options"); - process.exit(2); - } - - const nameOutput = - option.flags.replace(/^.+[[<]/, "").replace(/(\.\.\.)?[\]>].*$/, "") + - (option.variadic === true ? "..." : ""); - const value = option.required - ? `<${nameOutput}>` - : option.optional - ? `[${nameOutput}]` - : ""; - - this.logger.raw( - `${bold("Usage")}: webpack${isCommandSpecified ? ` ${commandName}` : ""} ${option.long}${ - value ? ` ${value}` : "" - }`, - ); - - if (option.short) { - this.logger.raw( - `${bold("Short:")} webpack${isCommandSpecified ? ` ${commandName}` : ""} ${ - option.short - }${value ? ` ${value}` : ""}`, - ); - } - - if (option.description) { - this.logger.raw(`${bold("Description:")} ${option.description}`); - } - - if (!option.negate && option.defaultValue) { - this.logger.raw(`${bold("Default value:")} ${JSON.stringify(option.defaultValue)}`); - } - - const flag = this.getBuiltInOptions().find((flag) => option.long === `--${flag.name}`); - - if (flag?.configs) { - const possibleValues = flag.configs.reduce((accumulator, currentValue) => { - if (currentValue.values) { - return [...accumulator, ...currentValue.values]; - } - - return accumulator; - }, [] as EnumValue[]); - - if (possibleValues.length > 0) { - // Convert the possible values to a union type string - // ['mode', 'development', 'production'] => "'mode' | 'development' | 'production'" - // [false, 'eval'] => "false | 'eval'" - const possibleValuesUnionTypeString = possibleValues - .map((value) => (typeof value === "string" ? `'${value}'` : value)) - .join(" | "); - - this.logger.raw(`${bold("Possible values:")} ${possibleValuesUnionTypeString}`); - } - } - - this.logger.raw(""); + const isRootCommand = thisCommand.args.length === 0; - // TODO implement this after refactor cli arguments - // logger.raw('Documentation: https://webpack.js.org/option/name/'); - } else { - outputIncorrectUsageOfHelp(); - } - - this.logger.raw( - "To see list of all supported commands and options run 'webpack --help=verbose'.\n", - ); - this.logger.raw(`${bold("Webpack documentation:")} https://webpack.js.org/.`); - this.logger.raw(`${bold("CLI documentation:")} https://webpack.js.org/api/cli/.`); - this.logger.raw(`${bold("Made with ♥ by the webpack team")}.`); - process.exit(0); - }; - this.program.helpOption(false); - // Suppress the default help command - this.program.helpCommand(false); - this.program.option("-h, --help [verbose]", "Display help for commands and options."); - - let isInternalActionCalled = false; - - // Default action - this.program.usage("[options]"); - this.program.allowUnknownOption(true); - - // Basic command for lazy loading other commands - this.program.action(async (options, program: WebpackCLICommand) => { - if (!isInternalActionCalled) { - isInternalActionCalled = true; - } else { - this.logger.error("No commands found to run"); - process.exit(2); - } - - // Command and options - const { operands, unknown } = this.program.parseOptions(program.args); - const defaultCommandToRun = getCommandName(buildCommandOptions.name); - const hasOperand = typeof operands[0] !== "undefined"; - const operand = hasOperand ? operands[0] : defaultCommandToRun; - const isHelpOption = typeof options.help !== "undefined"; - const isHelpCommandSyntax = isCommand(operand, helpCommandOptions); - - if (isHelpOption || isHelpCommandSyntax) { - let isVerbose = false; - - if (isHelpOption && typeof options.help === "string") { - if (options.help !== "verbose") { - this.logger.error("Unknown value for '--help' option, please use '--help=verbose'"); - process.exit(2); + if (help === "verbose" && !isRootCommand) { + actionCommand.configureHelp({ + visibleOptions: (cmd) => cmd.options as WebpackCLICommandOption[], + }); } - isVerbose = true; + (isRootCommand ? thisCommand : actionCommand).help({ error: false }); } - this.program.forHelp = true; - - const optionsForHelp = [ - ...(isHelpOption && hasOperand ? [operand] : []), - ...operands.slice(1), - ...unknown, - ...(isHelpCommandSyntax && typeof options.color !== "undefined" - ? [options.color ? "--color" : "--no-color"] - : []), - ...(isHelpCommandSyntax && typeof options.version !== "undefined" ? ["--version"] : []), - ]; - - await outputHelp(optionsForHelp, isVerbose, isHelpCommandSyntax, program); - } - - const isVersionOption = typeof options.version !== "undefined"; + if (version) { + const info = await cli.getInfoOutput({}); - if (isVersionOption) { - const info = await this.getInfoOutput({ output: "", additionalPackage: [] }); - this.logger.raw(info); - process.exit(0); - } - - let commandToRun = operand; - let commandOperands = operands.slice(1); - - if (isKnownCommand(commandToRun)) { - await loadCommandByName(commandToRun, true); - } else { - const isEntrySyntax = fs.existsSync(operand); - - if (isEntrySyntax) { - commandToRun = defaultCommandToRun; - commandOperands = operands; - - await loadCommandByName(commandToRun); - } else { - this.logger.error(`Unknown command or entry '${operand}'`); - - const levenshtein = require("fastest-levenshtein"); - - const found = knownCommands.find( - (commandOptions) => - levenshtein.distance(operand, getCommandName(commandOptions.name)) < 3, - ); - - if (found) { - this.logger.error( - `Did you mean '${getCommandName(found.name)}' (alias '${ - Array.isArray(found.alias) ? found.alias.join(", ") : found.alias - }')?`, - ); - } - - this.logger.error("Run 'webpack --help' to see available commands and options"); - process.exit(2); + cli.logger.raw(info); + process.exit(0); } - } - - await this.program.parseAsync([commandToRun, ...commandOperands, ...unknown], { - from: "user", }); - }); await this.program.parseAsync(args, parseOptions); } diff --git a/test/api/CLI.test.js b/test/api/CLI.test.js index 28de85d0cc2..15af9c62c2c 100644 --- a/test/api/CLI.test.js +++ b/test/api/CLI.test.js @@ -1,6 +1,7 @@ const CLI = require("../../packages/webpack-cli/lib/webpack-cli"); describe("CLI API", () => { + /** @type {CLI.default} */ let cli; beforeEach(() => { @@ -19,8 +20,12 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand({ name: "command" }, [], (options) => { - expect(options).toEqual({}); + const command = await cli.makeCommand({ + name: "command", + options: [], + action: (options) => { + expect(options).toEqual({}); + }, }); command.parseAsync([], { from: "user" }); @@ -31,20 +36,18 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean", description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ boolean: true }); }, - ); + }); command.parseAsync(["--boolean"], { from: "user" }); }); @@ -54,21 +57,19 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean", type: Boolean, description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ boolean: true }); }, - ); + }); command.parseAsync(["--boolean"], { from: "user" }); }); @@ -78,22 +79,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean", type: Boolean, description: "description", negative: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ boolean: false }); }, - ); + }); command.parseAsync(["--no-boolean"], { from: "user" }); }); @@ -103,11 +102,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "configs-boolean", configs: [ @@ -117,11 +114,11 @@ describe("CLI API", () => { ], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ configsBoolean: false }); }, - ); + }); command.parseAsync(["--no-configs-boolean"], { from: "user" }); }); @@ -131,11 +128,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "configs-number", configs: [ @@ -145,11 +140,11 @@ describe("CLI API", () => { ], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ configsNumber: 42 }); }, - ); + }); command.parseAsync(["--configs-number", "42"], { from: "user" }); }); @@ -159,11 +154,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "configs-string", configs: [ @@ -173,11 +166,11 @@ describe("CLI API", () => { ], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ configsString: "foo" }); }, - ); + }); command.parseAsync(["--configs-string", "foo"], { from: "user" }); }); @@ -187,11 +180,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "configs-path", configs: [ @@ -201,11 +192,11 @@ describe("CLI API", () => { ], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ configsPath: "/root/foo" }); }, - ); + }); command.parseAsync(["--configs-path", "/root/foo"], { from: "user", @@ -217,11 +208,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "configs-regexp", configs: [ @@ -231,11 +220,11 @@ describe("CLI API", () => { ], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ configsRegexp: "\\w+" }); }, - ); + }); command.parseAsync(["--configs-regexp", "\\w+"], { from: "user" }); }); @@ -245,11 +234,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "enum-string", configs: [ @@ -260,11 +247,11 @@ describe("CLI API", () => { ], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ enumString: "foo" }); }, - ); + }); command.parseAsync(["--enum-string", "foo"], { from: "user" }); }); @@ -274,11 +261,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "enum-number", configs: [ @@ -289,11 +274,11 @@ describe("CLI API", () => { ], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ enumNumber: 42 }); }, - ); + }); command.parseAsync(["--enum-number", "42"], { from: "user" }); }); @@ -303,11 +288,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "enum-boolean", configs: [ @@ -318,11 +301,11 @@ describe("CLI API", () => { ], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ enumBoolean: false }); }, - ); + }); command.parseAsync(["--no-enum-boolean"], { from: "user" }); }); @@ -332,22 +315,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean", type: Boolean, description: "description", negative: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ boolean: false }); }, - ); + }); command.parseAsync(["--boolean", "--no-boolean"], { from: "user" }); }); @@ -357,22 +338,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean", type: Boolean, description: "description", negative: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ boolean: true }); }, - ); + }); command.parseAsync(["--no-boolean", "--boolean"], { from: "user" }); }); @@ -382,22 +361,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean", type: Boolean, description: "description", defaultValue: false, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ boolean: false }); }, - ); + }); command.parseAsync([], { from: "user" }); }); @@ -407,21 +384,19 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "string", type: String, description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ string: "bar" }); }, - ); + }); command.parseAsync(["--string", "bar"], { from: "user" }); }); @@ -431,22 +406,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "string", alias: "s", type: String, description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ string: "foo" }); }, - ); + }); command.parseAsync(["-s", "foo"], { from: "user" }); }); @@ -456,22 +429,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "string", type: String, description: "description", defaultValue: "default-value", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ string: "default-value" }); }, - ); + }); command.parseAsync([], { from: "user" }); }); @@ -481,22 +452,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "string", type: String, description: "description", defaultValue: "default-value", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ string: "foo" }); }, - ); + }); command.parseAsync(["--string", "foo"], { from: "user" }); }); @@ -506,21 +475,19 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "string", type: String, description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ string: "bar" }); }, - ); + }); command.parseAsync(["--string=bar"], { from: "user" }); }); @@ -530,22 +497,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "string", multiple: true, type: String, description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ string: ["foo", "bar"] }); }, - ); + }); command.parseAsync(["--string", "foo", "bar"], { from: "user" }); }); @@ -555,11 +520,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "string", multiple: true, @@ -567,11 +530,11 @@ describe("CLI API", () => { description: "description", defaultValue: "string", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ string: "string" }); }, - ); + }); command.parseAsync([], { from: "user" }); }); @@ -581,11 +544,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "string", multiple: true, @@ -593,11 +554,11 @@ describe("CLI API", () => { description: "description", defaultValue: "string", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ string: ["foo", "bar"] }); }, - ); + }); command.parseAsync(["--string", "foo", "--string", "bar"], { from: "user", @@ -609,22 +570,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "string", multiple: true, type: String, description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ string: ["foo", "bar"] }); }, - ); + }); command.parseAsync(["--string", "foo", "--string", "bar"], { from: "user", @@ -636,21 +595,19 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "number", type: Number, description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ number: 12 }); }, - ); + }); command.parseAsync(["--number", "12"], { from: "user" }); }); @@ -660,22 +617,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "number", type: Number, description: "description", defaultValue: 20, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ number: 20 }); }, - ); + }); command.parseAsync([], { from: "user" }); }); @@ -685,22 +640,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "number", multiple: true, type: Number, description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ number: [1, 2] }); }, - ); + }); command.parseAsync(["--number", "1", "--number", "2"], { from: "user", @@ -712,11 +665,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "number", multiple: true, @@ -724,11 +675,11 @@ describe("CLI API", () => { description: "description", defaultValue: 50, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ number: [1, 2] }); }, - ); + }); command.parseAsync(["--number", "1", "--number", "2"], { from: "user", @@ -740,11 +691,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "number", multiple: true, @@ -752,11 +701,11 @@ describe("CLI API", () => { description: "description", defaultValue: 50, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ number: 50 }); }, - ); + }); command.parseAsync([], { from: "user" }); }); @@ -766,21 +715,19 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "custom", type: () => "function", description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ custom: "function" }); }, - ); + }); command.parseAsync(["--custom", "value"], { from: "user" }); }); @@ -790,22 +737,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "custom", type: () => "function", description: "description", defaultValue: "default", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ custom: "default" }); }, - ); + }); command.parseAsync([], { from: "user" }); }); @@ -815,22 +760,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "custom", type: (value, previous = []) => [...previous, value], description: "description", multiple: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ custom: ["value", "other"] }); }, - ); + }); command.parseAsync(["--custom", "value", "--custom", "other"], { from: "user", @@ -842,11 +785,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "custom", type: (value, previous = []) => [...previous, value], @@ -854,11 +795,11 @@ describe("CLI API", () => { multiple: true, defaultValue: 50, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ custom: 50 }); }, - ); + }); command.parseAsync([], { from: "user" }); }); @@ -870,11 +811,9 @@ describe("CLI API", () => { let skipDefault = true; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "custom", type: (value, previous = []) => { @@ -889,11 +828,11 @@ describe("CLI API", () => { multiple: true, defaultValue: 50, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ custom: ["foo"] }); }, - ); + }); command.parseAsync(["--custom", "foo"], { from: "user" }); }); @@ -903,21 +842,19 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-string", type: [Boolean, String], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndString: true }); }, - ); + }); command.parseAsync(["--boolean-and-string"], { from: "user" }); }); @@ -927,21 +864,19 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-string", type: [Boolean, String], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndString: "value" }); }, - ); + }); command.parseAsync(["--boolean-and-string", "value"], { from: "user", @@ -953,22 +888,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-string", type: [Boolean, String], description: "description", multiple: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndString: true }); }, - ); + }); command.parseAsync(["--boolean-and-string"], { from: "user" }); }); @@ -978,24 +911,22 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-string", type: [Boolean, String], description: "description", multiple: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndString: ["bar", "baz"], }); }, - ); + }); command.parseAsync(["--boolean-and-string", "bar", "--boolean-and-string", "baz"], { from: "user", @@ -1007,22 +938,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-string", type: [Boolean, String], description: "description", negative: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndString: true }); }, - ); + }); command.parseAsync(["--boolean-and-string"], { from: "user" }); }); @@ -1032,22 +961,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-string", type: [Boolean, String], description: "description", negative: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndString: "foo" }); }, - ); + }); command.parseAsync(["--boolean-and-string", "foo"], { from: "user", @@ -1059,22 +986,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-string", type: [Boolean, String], description: "description", negative: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndString: false }); }, - ); + }); command.parseAsync(["--no-boolean-and-string"], { from: "user" }); }); @@ -1084,21 +1009,19 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number", type: [Boolean, Number], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumber: true }); }, - ); + }); command.parseAsync(["--boolean-and-number"], { from: "user" }); }); @@ -1108,21 +1031,19 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number", type: [Boolean, Number], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumber: 12 }); }, - ); + }); command.parseAsync(["--boolean-and-number", "12"], { from: "user", @@ -1134,21 +1055,19 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean", type: [Boolean], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ boolean: true }); }, - ); + }); command.parseAsync(["--boolean"], { from: "user" }); }); @@ -1158,23 +1077,21 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: true, }); }, - ); + }); command.parseAsync(["--boolean-and-number-and-string"], { from: "user", @@ -1186,21 +1103,19 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: 12 }); }, - ); + }); command.parseAsync(["--boolean-and-number-and-string", "12"], { from: "user", @@ -1212,23 +1127,21 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: "bar", }); }, - ); + }); command.parseAsync(["--boolean-and-number-and-string", "bar"], { from: "user", @@ -1240,24 +1153,22 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], description: "description", defaultValue: "default", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: "default", }); }, - ); + }); command.parseAsync([], { from: "user" }); }); @@ -1267,24 +1178,22 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], description: "description", defaultValue: "default", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: "foo", }); }, - ); + }); command.parseAsync(["--boolean-and-number-and-string", "foo"], { from: "user", @@ -1296,22 +1205,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], description: "description", defaultValue: "default", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: 12 }); }, - ); + }); command.parseAsync(["--boolean-and-number-and-string", "12"], { from: "user", @@ -1323,24 +1230,22 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], description: "description", defaultValue: "default", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: true, }); }, - ); + }); command.parseAsync(["--boolean-and-number-and-string"], { from: "user", @@ -1352,24 +1257,22 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], description: "description", multiple: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: true, }); }, - ); + }); command.parseAsync(["--boolean-and-number-and-string"], { from: "user", @@ -1381,24 +1284,22 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], description: "description", multiple: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: ["foo"], }); }, - ); + }); command.parseAsync(["--boolean-and-number-and-string", "foo"], { from: "user", @@ -1410,24 +1311,22 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], description: "description", multiple: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: [12], }); }, - ); + }); command.parseAsync(["--boolean-and-number-and-string", "12"], { from: "user", @@ -1439,24 +1338,22 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], description: "description", multiple: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: ["foo", "bar"], }); }, - ); + }); command.parseAsync( ["--boolean-and-number-and-string", "foo", "--boolean-and-number-and-string", "bar"], @@ -1469,24 +1366,22 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], description: "description", multiple: true, }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: ["foo", 12], }); }, - ); + }); command.parseAsync( ["--boolean-and-number-and-string", "foo", "--boolean-and-number-and-string", "12"], @@ -1499,11 +1394,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], @@ -1511,13 +1404,13 @@ describe("CLI API", () => { multiple: true, defaultValue: "default", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: "default", }); }, - ); + }); command.parseAsync([], { from: "user" }); }); @@ -1527,11 +1420,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], @@ -1539,13 +1430,13 @@ describe("CLI API", () => { multiple: true, defaultValue: "default", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: ["foo"], }); }, - ); + }); command.parseAsync(["--boolean-and-number-and-string", "foo"], { from: "user", @@ -1557,11 +1448,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], @@ -1569,13 +1458,13 @@ describe("CLI API", () => { multiple: true, defaultValue: "default", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: [12], }); }, - ); + }); command.parseAsync(["--boolean-and-number-and-string", "12"], { from: "user", @@ -1587,11 +1476,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean-and-number-and-string", type: [Boolean, Number, String], @@ -1599,13 +1486,13 @@ describe("CLI API", () => { multiple: true, defaultValue: "default", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ booleanAndNumberAndString: ["foo", 12], }); }, - ); + }); command.parseAsync( ["--boolean-and-number-and-string", "foo", "--boolean-and-number-and-string", "12"], @@ -1618,21 +1505,19 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "unknown", type: [Boolean, Symbol], description: "description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ unknown: "foo" }); }, - ); + }); command.parseAsync(["--unknown", "foo"], { from: "user" }); }); @@ -1642,22 +1527,20 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean", type: Boolean, description: "Description", negatedDescription: "Negated description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ boolean: true }); }, - ); + }); command.parseAsync(["--boolean"], { from: "user" }); @@ -1669,11 +1552,9 @@ describe("CLI API", () => { cli.program.commands = []; - const command = await cli.makeCommand( - { - name: "command", - }, - [ + const command = await cli.makeCommand({ + name: "command", + options: [ { name: "boolean", type: Boolean, @@ -1681,44 +1562,15 @@ describe("CLI API", () => { negative: true, negatedDescription: "Negated description", }, - ], - (options) => { + ].flatMap(cli.makeOption.bind(cli)), + action: (options) => { expect(options).toEqual({ boolean: false }); }, - ); + }); command.parseAsync(["--no-boolean"], { from: "user" }); expect(command.helpInformation()).toContain("--no-boolean Negated description"); }); }); - - describe("custom help output", () => { - let consoleSpy; - let exitSpy; - - beforeEach(async () => { - consoleSpy = jest.spyOn(globalThis.console, "log"); - exitSpy = jest.spyOn(process, "exit").mockImplementation(() => {}); - - await new Promise((resolve, reject) => { - try { - cli.run(["help", "--mode"], { from: "user" }); - resolve(); - } catch (error) { - reject(error); - } - }); - }); - - afterEach(async () => { - consoleSpy.mockRestore(); - exitSpy.mockRestore(); - }); - - it("should display help information", () => { - expect(exitSpy).toHaveBeenCalledWith(0); - expect(consoleSpy.mock.calls).toMatchSnapshot(); - }); - }); }); diff --git a/test/api/__snapshots__/CLI.test.js.snap.webpack5 b/test/api/__snapshots__/CLI.test.js.snap.webpack5 deleted file mode 100644 index 1416f8f80b0..00000000000 --- a/test/api/__snapshots__/CLI.test.js.snap.webpack5 +++ /dev/null @@ -1,31 +0,0 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing - -exports[`CLI API custom help output should display help information 1`] = ` -[ - [ - "Usage: webpack --mode ", - ], - [ - "Description: Enable production optimizations or development hints.", - ], - [ - "Possible values: 'development' | 'production' | 'none'", - ], - [ - "", - ], - [ - "To see list of all supported commands and options run 'webpack --help=verbose'. -", - ], - [ - "Webpack documentation: https://webpack.js.org/.", - ], - [ - "CLI documentation: https://webpack.js.org/api/cli/.", - ], - [ - "Made with ♥ by the webpack team.", - ], -] -`; diff --git a/test/build/basic/basic.test.js b/test/build/basic/basic.test.js index 92033d98ba3..02fa288c469 100644 --- a/test/build/basic/basic.test.js +++ b/test/build/basic/basic.test.js @@ -173,8 +173,8 @@ describe("bundle command", () => { const { exitCode, stderr, stdout } = await run(__dirname, ["buil"]); expect(exitCode).toBe(2); - expect(stderr).toContain("Unknown command or entry 'buil'"); - expect(stderr).toContain("Did you mean 'build' (alias 'bundle, b')?"); + expect(stderr).toContain("Unknown command 'buil'"); + expect(stderr).toContain("Did you mean build?"); expect(stderr).toContain("Run 'webpack --help' to see available commands and options"); expect(stdout).toBeFalsy(); }); diff --git a/test/build/unknown/__snapshots__/unknown.test.js.snap.webpack5 b/test/build/unknown/__snapshots__/unknown.test.js.snap.webpack5 index 7ccf7eb98f1..b80b4fd1360 100644 --- a/test/build/unknown/__snapshots__/unknown.test.js.snap.webpack5 +++ b/test/build/unknown/__snapshots__/unknown.test.js.snap.webpack5 @@ -37,7 +37,6 @@ exports[`unknown behaviour should log an error if an unknown flag is passed and exports[`unknown behaviour should log an error if an unknown flag is passed and suggests the closest match to an unknown flag #2: stderr 1`] = ` "[webpack-cli] Error: Unknown option '--output-fileneme' -[webpack-cli] Did you mean '--output-filename'? [webpack-cli] Run 'webpack --help' to see available commands and options" `; @@ -45,8 +44,6 @@ exports[`unknown behaviour should log an error if an unknown flag is passed and exports[`unknown behaviour should log an error if an unknown flag is passed and suggests the closest match to an unknown flag #3: stderr 1`] = ` "[webpack-cli] Error: Unknown option '--output-library-auxiliary-comment-commnjs' -[webpack-cli] Did you mean '--output-library-auxiliary-comment-commonjs'? -[webpack-cli] Did you mean '--output-library-auxiliary-comment-commonjs2'? [webpack-cli] Run 'webpack --help' to see available commands and options" `; @@ -54,7 +51,7 @@ exports[`unknown behaviour should log an error if an unknown flag is passed and exports[`unknown behaviour should log an error if an unknown flag is passed and suggests the closest match to an unknown flag using "b" command: stderr 1`] = ` "[webpack-cli] Error: Unknown option '--entyr' -[webpack-cli] Did you mean '--entry'? +(Did you mean --entry?) [webpack-cli] Run 'webpack --help' to see available commands and options" `; @@ -62,7 +59,7 @@ exports[`unknown behaviour should log an error if an unknown flag is passed and exports[`unknown behaviour should log an error if an unknown flag is passed and suggests the closest match to an unknown flag using "bundle" command: stderr 1`] = ` "[webpack-cli] Error: Unknown option '--entyr' -[webpack-cli] Did you mean '--entry'? +(Did you mean --entry?) [webpack-cli] Run 'webpack --help' to see available commands and options" `; @@ -70,7 +67,6 @@ exports[`unknown behaviour should log an error if an unknown flag is passed and exports[`unknown behaviour should log an error if an unknown flag is passed and suggests the closest match to an unknown flag using "i" command: stderr 1`] = ` "[webpack-cli] Error: Unknown option '--outpyt' -[webpack-cli] Did you mean '--output'? [webpack-cli] Run 'webpack --help' to see available commands and options" `; @@ -78,7 +74,6 @@ exports[`unknown behaviour should log an error if an unknown flag is passed and exports[`unknown behaviour should log an error if an unknown flag is passed and suggests the closest match to an unknown flag using "info" command: stderr 1`] = ` "[webpack-cli] Error: Unknown option '--outpyt' -[webpack-cli] Did you mean '--output'? [webpack-cli] Run 'webpack --help' to see available commands and options" `; @@ -86,7 +81,7 @@ exports[`unknown behaviour should log an error if an unknown flag is passed and exports[`unknown behaviour should log an error if an unknown flag is passed and suggests the closest match to an unknown flag: stderr 1`] = ` "[webpack-cli] Error: Unknown option '--entyr' -[webpack-cli] Did you mean '--entry'? +(Did you mean --entry?) [webpack-cli] Run 'webpack --help' to see available commands and options" `; @@ -135,16 +130,17 @@ exports[`unknown behaviour should log an error if an unknown flag is passed: std exports[`unknown behaviour should log an error if an unknown flag is passed: stdout 1`] = `""`; exports[`unknown behaviour should log error and provide suggestion if an unknown command passed: stderr 1`] = ` -"[webpack-cli] Unknown command or entry 'serverr' -[webpack-cli] Did you mean 'serve' (alias 'server, s')? +"[webpack-cli] Error: Unknown command 'serverr' +(Did you mean server?) [webpack-cli] Run 'webpack --help' to see available commands and options" `; exports[`unknown behaviour should log error and provide suggestion if an unknown command passed: stdout 1`] = `""`; exports[`unknown behaviour should log error and respect --color flag: stderr 1`] = ` -"[webpack-cli] Error: Unknown option '--unknown' -[webpack-cli] Run 'webpack --help' to see available commands and options" +"[webpack-cli] Error: Unknown option '--unknown' +[webpack-cli] Run 'webpack --help' to see available commands and options +" `; exports[`unknown behaviour should log error and respect --color flag: stdout 1`] = `""`; @@ -157,7 +153,7 @@ exports[`unknown behaviour should log error for unknown flag and respect --no-co exports[`unknown behaviour should log error for unknown flag and respect --no-color: stdout 1`] = `""`; exports[`unknown behaviour should log error if an unknown command passed: stderr 1`] = ` -"[webpack-cli] Unknown command or entry 'qqq' +"[webpack-cli] Error: Unknown command 'qqq' [webpack-cli] Run 'webpack --help' to see available commands and options" `; diff --git a/test/help/__snapshots__/help.test.js.snap.devServer5.webpack5 b/test/help/__snapshots__/help.test.js.snap.devServer5.webpack5 index 57f4dd4b362..b7df71120a5 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer5.webpack5 +++ b/test/help/__snapshots__/help.test.js.snap.devServer5.webpack5 @@ -1,2914 +1,49 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`help should log error for invalid command using command syntax #3: stderr 1`] = ` -"[webpack-cli] Incorrect use of help -[webpack-cli] Please use: 'webpack help [command] [option]' | 'webpack [command] --help' -[webpack-cli] Run 'webpack --help' to see available commands and options" -`; - -exports[`help should log error for invalid command using command syntax #3: stdout 1`] = `""`; - -exports[`help should log error for invalid command using command syntax #4: stderr 1`] = ` -"[webpack-cli] Incorrect use of help -[webpack-cli] Please use: 'webpack help [command] [option]' | 'webpack [command] --help' -[webpack-cli] Run 'webpack --help' to see available commands and options" -`; - -exports[`help should log error for invalid command using command syntax #4: stdout 1`] = `""`; - -exports[`help should log error for invalid command using the "--help" option #2: stderr 1`] = ` -"[webpack-cli] Incorrect use of help -[webpack-cli] Please use: 'webpack help [command] [option]' | 'webpack [command] --help' -[webpack-cli] Run 'webpack --help' to see available commands and options" -`; - -exports[`help should log error for invalid command using the "--help" option #2: stdout 1`] = `""`; - -exports[`help should log error for invalid command using the "--help" option #3: stderr 1`] = ` -"[webpack-cli] Incorrect use of help -[webpack-cli] Please use: 'webpack help [command] [option]' | 'webpack [command] --help' -[webpack-cli] Run 'webpack --help' to see available commands and options" -`; - -exports[`help should log error for invalid command using the "--help" option #3: stdout 1`] = `""`; - -exports[`help should log error for invalid command using the "--help" option: stderr 1`] = `"[webpack-cli] Unknown value for '--help' option, please use '--help=verbose'"`; - -exports[`help should log error for invalid command using the "--help" option: stdout 1`] = `""`; - -exports[`help should log error for invalid flag with the "--help" option #2: stderr 1`] = `"[webpack-cli] Unknown value for '--help' option, please use '--help=verbose'"`; - -exports[`help should log error for invalid flag with the "--help" option #2: stdout 1`] = `""`; - -exports[`help should log error for invalid flag with the "--help" option #3 1`] = `"[webpack-cli] Unknown value for '--help' option, please use '--help=verbose'"`; - -exports[`help should log error for invalid flag with the "--help" option: stderr 1`] = ` -"[webpack-cli] Incorrect use of help -[webpack-cli] Please use: 'webpack help [command] [option]' | 'webpack [command] --help' -[webpack-cli] Run 'webpack --help' to see available commands and options" -`; - -exports[`help should log error for invalid flag with the "--help" option: stdout 1`] = `""`; - -exports[`help should log error for unknown command using command syntax #2: stderr 1`] = ` -"[webpack-cli] Can't find and load command 'verbose' -[webpack-cli] Run 'webpack --help' to see available commands and options." -`; - -exports[`help should log error for unknown command using command syntax #2: stdout 1`] = `""`; - -exports[`help should log error for unknown command using command syntax: stderr 1`] = ` -"[webpack-cli] Can't find and load command 'myCommand' -[webpack-cli] Run 'webpack --help' to see available commands and options." -`; - -exports[`help should log error for unknown command using command syntax: stdout 1`] = `""`; - -exports[`help should log error for unknown option using command syntax #2: stderr 1`] = ` -"[webpack-cli] Unknown option '--made' -[webpack-cli] Run 'webpack --help' to see available commands and options" -`; - -exports[`help should log error for unknown option using command syntax #2: stdout 1`] = `""`; - -exports[`help should log error for unknown option using command syntax #3: stderr 1`] = ` -"[webpack-cli] Unknown option '--made' -[webpack-cli] Run 'webpack --help' to see available commands and options" -`; - -exports[`help should log error for unknown option using command syntax #3: stdout 1`] = `""`; - -exports[`help should log error for unknown option using command syntax #4: stderr 1`] = ` -"[webpack-cli] Can't find and load command 'bui' -[webpack-cli] Run 'webpack --help' to see available commands and options" -`; - -exports[`help should log error for unknown option using command syntax #4: stdout 1`] = `""`; - -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -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. - info|i [options] Outputs information about your system. - serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. - version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - 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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -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. - info|i [options] Outputs information about your system. - serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. - version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - 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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -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. - info|i [options] Outputs information about your system. - serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. - version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - 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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - --no-amd Negative 'amd' option. - --bail Report the first error as a hard error instead of tolerating it. - --no-bail Negative 'bail' option. - --cache Enable in memory caching. Disable caching. - --no-cache Negative 'cache' option. - --cache-cache-unaffected Additionally cache computation of modules that are unchanged and reference only unchanged modules. - --no-cache-cache-unaffected Negative 'cache-cache-unaffected' option. - --cache-max-generations Number of generations unused cache entries stay in memory cache - at stack. - --watch-options-poll [value] \`number\`: use polling with specified interval. \`true\`: use polling. - --no-watch-options-poll Negative 'watch-options-poll' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - --no-amd Negative 'amd' option. - --bail Report the first error as a hard error instead of tolerating it. - --no-bail Negative 'bail' option. - --cache Enable in memory caching. Disable caching. - --no-cache Negative 'cache' option. - --cache-cache-unaffected Additionally cache computation of modules that are unchanged and reference only unchanged modules. - --no-cache-cache-unaffected Negative 'cache-cache-unaffected' option. - --cache-max-generations Number of generations unused cache entries stay in memory cache - at stack. - --watch-options-poll [value] \`number\`: use polling with specified interval. \`true\`: use polling. - --no-watch-options-poll Negative 'watch-options-poll' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Negative 'watch-options-stdin' option. - --allowed-hosts Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --bonjour Allows to broadcasts dev server via ZeroConf networking on start. - --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start. - --no-client Disables client script. - --client-logging Allows to set log level in the browser. - --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings. - --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors. - --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors. - --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings. - --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings. - --client-overlay-runtime-errors Enables a full-screen overlay in the browser when there are uncaught runtime errors. - --no-client-overlay-runtime-errors Disables the full-screen overlay in the browser when there are uncaught runtime errors. - --client-overlay-trusted-types-policy-name The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'. - --client-progress [value] Displays compilation progress in the browser. Options include 'linear' and 'circular' for visual indicators. - --no-client-progress Does not display compilation progress in the browser. - --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client. - --no-client-reconnect Tells dev-server to not to try to reconnect the client. - --client-web-socket-transport Allows to set custom web socket transport to communicate with dev server. - --client-web-socket-url Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to). - --client-web-socket-url-hostname Tells clients connected to devServer to use the provided hostname. - --client-web-socket-url-pathname Tells clients connected to devServer to use the provided path to connect. - --client-web-socket-url-password Tells clients connected to devServer to use the provided password to authenticate. - --client-web-socket-url-port Tells clients connected to devServer to use the provided port. - --client-web-socket-url-protocol Tells clients connected to devServer to use the provided protocol. - --client-web-socket-url-username Tells clients connected to devServer to use the provided username to authenticate. - --compress Enables gzip compression for everything served. - --no-compress Disables gzip compression for everything served. - --history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API. - --no-history-api-fallback Disallows to proxy requests through a specified index page. - --host Allows to specify a hostname to use. - --hot [value] Enables Hot Module Replacement. - --no-hot Disables Hot Module Replacement. - --ipc [value] Listen to a unix socket. - --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default). - --no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default). - --open [value...] Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --no-open Does not open the default browser. - --open-target Opens specified page in browser. - --open-app-name Open specified browser. - --open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser. - --open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser. - --port Allows to specify a port to use. - --server-type Allows to set server and options (by default 'http'). - --server-options-passphrase Passphrase for a pfx file. - --server-options-request-cert Request for an SSL certificate. - --no-server-options-request-cert Does not request for an SSL certificate. - --server-options-ca Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-ca-reset Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-cert Path to an SSL certificate or content of an SSL certificate. - --server-options-cert-reset Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate. - --server-options-crl Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-crl-reset Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-key Path to an SSL key or content of an SSL key. - --server-options-key-reset Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key. - --server-options-pfx Path to an SSL pfx file or content of an SSL pfx file. - --server-options-pfx-reset Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. - --static [value...] Allows to configure options for serving static files from directory (by default 'public' directory). - --no-static Disallows to configure options for serving static files from directory. - --static-directory Directory for static contents. - --static-public-path The static files will be available in the browser under this public path. - --static-serve-index Tells dev server to use serveIndex middleware when enabled. - --no-static-serve-index Does not tell dev server to use serveIndex middleware. - --static-watch Watches for files in static content directory. - --no-static-watch Does not watch for files in static content directory. - --static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory). - --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path. - --watch-files Allows to configure list of globs/directories/files to watch for file changes. - --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - --no-amd Negative 'amd' option. - --bail Report the first error as a hard error instead of tolerating it. - --no-bail Negative 'bail' option. - --cache Enable in memory caching. Disable caching. - --no-cache Negative 'cache' option. - --cache-cache-unaffected Additionally cache computation of modules that are unchanged and reference only unchanged modules. - --no-cache-cache-unaffected Negative 'cache-cache-unaffected' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Negative 'watch-options-stdin' option. - --allowed-hosts Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --bonjour Allows to broadcasts dev server via ZeroConf networking on start. - --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start. - --no-client Disables client script. - --client-logging Allows to set log level in the browser. - --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings. - --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors. - --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors. - --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings. - --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings. - --client-overlay-runtime-errors Enables a full-screen overlay in the browser when there are uncaught runtime errors. - --no-client-overlay-runtime-errors Disables the full-screen overlay in the browser when there are uncaught runtime errors. - --client-overlay-trusted-types-policy-name The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'. - --client-progress [value] Displays compilation progress in the browser. Options include 'linear' and 'circular' for visual indicators. - --no-client-progress Does not display compilation progress in the browser. - --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client. - --no-client-reconnect Tells dev-server to not to try to reconnect the client. - --client-web-socket-transport Allows to set custom web socket transport to communicate with dev server. - --client-web-socket-url Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to). - --client-web-socket-url-hostname Tells clients connected to devServer to use the provided hostname. - --client-web-socket-url-pathname Tells clients connected to devServer to use the provided path to connect. - --client-web-socket-url-password Tells clients connected to devServer to use the provided password to authenticate. - --client-web-socket-url-port Tells clients connected to devServer to use the provided port. - --client-web-socket-url-protocol Tells clients connected to devServer to use the provided protocol. - --client-web-socket-url-username Tells clients connected to devServer to use the provided username to authenticate. - --compress Enables gzip compression for everything served. - --no-compress Disables gzip compression for everything served. - --history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API. - --no-history-api-fallback Disallows to proxy requests through a specified index page. - --host Allows to specify a hostname to use. - --hot [value] Enables Hot Module Replacement. - --no-hot Disables Hot Module Replacement. - --ipc [value] Listen to a unix socket. - --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default). - --no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default). - --open [value...] Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --no-open Does not open the default browser. - --open-target Opens specified page in browser. - --open-app-name Open specified browser. - --open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser. - --open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser. - --port Allows to specify a port to use. - --server-type Allows to set server and options (by default 'http'). - --server-options-passphrase Passphrase for a pfx file. - --server-options-request-cert Request for an SSL certificate. - --no-server-options-request-cert Does not request for an SSL certificate. - --server-options-ca Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-ca-reset Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-cert Path to an SSL certificate or content of an SSL certificate. - --server-options-cert-reset Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate. - --server-options-crl Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-crl-reset Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-key Path to an SSL key or content of an SSL key. - --server-options-key-reset Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key. - --server-options-pfx Path to an SSL pfx file or content of an SSL pfx file. - --server-options-pfx-reset Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. - --static [value...] Allows to configure options for serving static files from directory (by default 'public' directory). - --no-static Disallows to configure options for serving static files from directory. - --static-directory Directory for static contents. - --static-public-path The static files will be available in the browser under this public path. - --static-serve-index Tells dev server to use serveIndex middleware when enabled. - --no-static-serve-index Does not tell dev server to use serveIndex middleware. - --static-watch Watches for files in static content directory. - --no-static-watch Does not watch for files in static content directory. - --static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory). - --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path. - --watch-files Allows to configure list of globs/directories/files to watch for file changes. - --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Negative 'watch-options-stdin' option. - --allowed-hosts Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --bonjour Allows to broadcasts dev server via ZeroConf networking on start. - --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start. - --no-client Disables client script. - --client-logging Allows to set log level in the browser. - --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings. - --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors. - --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors. - --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings. - --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings. - --client-overlay-runtime-errors Enables a full-screen overlay in the browser when there are uncaught runtime errors. - --no-client-overlay-runtime-errors Disables the full-screen overlay in the browser when there are uncaught runtime errors. - --client-overlay-trusted-types-policy-name The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'. - --client-progress [value] Displays compilation progress in the browser. Options include 'linear' and 'circular' for visual indicators. - --no-client-progress Does not display compilation progress in the browser. - --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client. - --no-client-reconnect Tells dev-server to not to try to reconnect the client. - --client-web-socket-transport Allows to set custom web socket transport to communicate with dev server. - --client-web-socket-url Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to). - --client-web-socket-url-hostname Tells clients connected to devServer to use the provided hostname. - --client-web-socket-url-pathname Tells clients connected to devServer to use the provided path to connect. - --client-web-socket-url-password Tells clients connected to devServer to use the provided password to authenticate. - --client-web-socket-url-port Tells clients connected to devServer to use the provided port. - --client-web-socket-url-protocol Tells clients connected to devServer to use the provided protocol. - --client-web-socket-url-username Tells clients connected to devServer to use the provided username to authenticate. - --compress Enables gzip compression for everything served. - --no-compress Disables gzip compression for everything served. - --history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API. - --no-history-api-fallback Disallows to proxy requests through a specified index page. - --host Allows to specify a hostname to use. - --hot [value] Enables Hot Module Replacement. - --no-hot Disables Hot Module Replacement. - --ipc [value] Listen to a unix socket. - --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default). - --no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default). - --open [value...] Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --no-open Does not open the default browser. - --open-target Opens specified page in browser. - --open-app-name Open specified browser. - --open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser. - --open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser. - --port Allows to specify a port to use. - --server-type Allows to set server and options (by default 'http'). - --server-options-passphrase Passphrase for a pfx file. - --server-options-request-cert Request for an SSL certificate. - --no-server-options-request-cert Does not request for an SSL certificate. - --server-options-ca Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-ca-reset Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-cert Path to an SSL certificate or content of an SSL certificate. - --server-options-cert-reset Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate. - --server-options-crl Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-crl-reset Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-key Path to an SSL key or content of an SSL key. - --server-options-key-reset Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key. - --server-options-pfx Path to an SSL pfx file or content of an SSL pfx file. - --server-options-pfx-reset Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. - --static [value...] Allows to configure options for serving static files from directory (by default 'public' directory). - --no-static Disallows to configure options for serving static files from directory. - --static-directory Directory for static contents. - --static-public-path The static files will be available in the browser under this public path. - --static-serve-index Tells dev server to use serveIndex middleware when enabled. - --no-static-serve-index Does not tell dev server to use serveIndex middleware. - --static-watch Watches for files in static content directory. - --no-static-watch Does not watch for files in static content directory. - --static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory). - --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path. - --watch-files Allows to configure list of globs/directories/files to watch for file changes. - --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Negative 'watch-options-stdin' option. - --allowed-hosts Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --bonjour Allows to broadcasts dev server via ZeroConf networking on start. - --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start. - --no-client Disables client script. - --client-logging Allows to set log level in the browser. - --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings. - --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors. - --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors. - --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings. - --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings. - --client-overlay-runtime-errors Enables a full-screen overlay in the browser when there are uncaught runtime errors. - --no-client-overlay-runtime-errors Disables the full-screen overlay in the browser when there are uncaught runtime errors. - --client-overlay-trusted-types-policy-name The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'. - --client-progress [value] Displays compilation progress in the browser. Options include 'linear' and 'circular' for visual indicators. - --no-client-progress Does not display compilation progress in the browser. - --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client. - --no-client-reconnect Tells dev-server to not to try to reconnect the client. - --client-web-socket-transport Allows to set custom web socket transport to communicate with dev server. - --client-web-socket-url Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to). - --client-web-socket-url-hostname Tells clients connected to devServer to use the provided hostname. - --client-web-socket-url-pathname Tells clients connected to devServer to use the provided path to connect. - --client-web-socket-url-password Tells clients connected to devServer to use the provided password to authenticate. - --client-web-socket-url-port Tells clients connected to devServer to use the provided port. - --client-web-socket-url-protocol Tells clients connected to devServer to use the provided protocol. - --client-web-socket-url-username Tells clients connected to devServer to use the provided username to authenticate. - --compress Enables gzip compression for everything served. - --no-compress Disables gzip compression for everything served. - --history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API. - --no-history-api-fallback Disallows to proxy requests through a specified index page. - --host Allows to specify a hostname to use. - --hot [value] Enables Hot Module Replacement. - --no-hot Disables Hot Module Replacement. - --ipc [value] Listen to a unix socket. - --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default). - --no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default). - --open [value...] Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --no-open Does not open the default browser. - --open-target Opens specified page in browser. - --open-app-name Open specified browser. - --open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser. - --open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser. - --port Allows to specify a port to use. - --server-type Allows to set server and options (by default 'http'). - --server-options-passphrase Passphrase for a pfx file. - --server-options-request-cert Request for an SSL certificate. - --no-server-options-request-cert Does not request for an SSL certificate. - --server-options-ca Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-ca-reset Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-cert Path to an SSL certificate or content of an SSL certificate. - --server-options-cert-reset Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate. - --server-options-crl Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-crl-reset Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-key Path to an SSL key or content of an SSL key. - --server-options-key-reset Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key. - --server-options-pfx Path to an SSL pfx file or content of an SSL pfx file. - --server-options-pfx-reset Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. - --static [value...] Allows to configure options for serving static files from directory (by default 'public' directory). - --no-static Disallows to configure options for serving static files from directory. - --static-directory Directory for static contents. - --static-public-path The static files will be available in the browser under this public path. - --static-serve-index Tells dev server to use serveIndex middleware when enabled. - --no-static-serve-index Does not tell dev server to use serveIndex middleware. - --static-watch Watches for files in static content directory. - --no-static-watch Does not watch for files in static content directory. - --static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory). - --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path. - --watch-files Allows to configure list of globs/directories/files to watch for file changes. - --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Negative 'watch-options-stdin' option. - --allowed-hosts Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --bonjour Allows to broadcasts dev server via ZeroConf networking on start. - --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start. - --no-client Disables client script. - --client-logging Allows to set log level in the browser. - --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings. - --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors. - --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors. - --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings. - --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings. - --client-overlay-runtime-errors Enables a full-screen overlay in the browser when there are uncaught runtime errors. - --no-client-overlay-runtime-errors Disables the full-screen overlay in the browser when there are uncaught runtime errors. - --client-overlay-trusted-types-policy-name The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'. - --client-progress [value] Displays compilation progress in the browser. Options include 'linear' and 'circular' for visual indicators. - --no-client-progress Does not display compilation progress in the browser. - --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client. - --no-client-reconnect Tells dev-server to not to try to reconnect the client. - --client-web-socket-transport Allows to set custom web socket transport to communicate with dev server. - --client-web-socket-url Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to). - --client-web-socket-url-hostname Tells clients connected to devServer to use the provided hostname. - --client-web-socket-url-pathname Tells clients connected to devServer to use the provided path to connect. - --client-web-socket-url-password Tells clients connected to devServer to use the provided password to authenticate. - --client-web-socket-url-port Tells clients connected to devServer to use the provided port. - --client-web-socket-url-protocol Tells clients connected to devServer to use the provided protocol. - --client-web-socket-url-username Tells clients connected to devServer to use the provided username to authenticate. - --compress Enables gzip compression for everything served. - --no-compress Disables gzip compression for everything served. - --history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API. - --no-history-api-fallback Disallows to proxy requests through a specified index page. - --host Allows to specify a hostname to use. - --hot [value] Enables Hot Module Replacement. - --no-hot Disables Hot Module Replacement. - --ipc [value] Listen to a unix socket. - --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default). - --no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default). - --open [value...] Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --no-open Does not open the default browser. - --open-target Opens specified page in browser. - --open-app-name Open specified browser. - --open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser. - --open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser. - --port Allows to specify a port to use. - --server-type Allows to set server and options (by default 'http'). - --server-options-passphrase Passphrase for a pfx file. - --server-options-request-cert Request for an SSL certificate. - --no-server-options-request-cert Does not request for an SSL certificate. - --server-options-ca Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-ca-reset Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-cert Path to an SSL certificate or content of an SSL certificate. - --server-options-cert-reset Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate. - --server-options-crl Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-crl-reset Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-key Path to an SSL key or content of an SSL key. - --server-options-key-reset Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key. - --server-options-pfx Path to an SSL pfx file or content of an SSL pfx file. - --server-options-pfx-reset Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. - --static [value...] Allows to configure options for serving static files from directory (by default 'public' directory). - --no-static Disallows to configure options for serving static files from directory. - --static-directory Directory for static contents. - --static-public-path The static files will be available in the browser under this public path. - --static-serve-index Tells dev server to use serveIndex middleware when enabled. - --no-static-serve-index Does not tell dev server to use serveIndex middleware. - --static-watch Watches for files in static content directory. - --no-static-watch Does not watch for files in static content directory. - --static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory). - --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path. - --watch-files Allows to configure list of globs/directories/files to watch for file changes. - --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - --no-amd Negative 'amd' option. - --bail Report the first error as a hard error instead of tolerating it. - --no-bail Negative 'bail' option. - --cache Enable in memory caching. Disable caching. - --no-cache Negative 'cache' option. - --cache-cache-unaffected Additionally cache computation of modules that are unchanged and reference only unchanged modules. - --no-cache-cache-unaffected Negative 'cache-cache-unaffected' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Negative 'watch-options-stdin' option. - --allowed-hosts Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --bonjour Allows to broadcasts dev server via ZeroConf networking on start. - --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start. - --no-client Disables client script. - --client-logging Allows to set log level in the browser. - --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings. - --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors. - --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors. - --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings. - --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings. - --client-overlay-runtime-errors Enables a full-screen overlay in the browser when there are uncaught runtime errors. - --no-client-overlay-runtime-errors Disables the full-screen overlay in the browser when there are uncaught runtime errors. - --client-overlay-trusted-types-policy-name The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'. - --client-progress [value] Displays compilation progress in the browser. Options include 'linear' and 'circular' for visual indicators. - --no-client-progress Does not display compilation progress in the browser. - --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client. - --no-client-reconnect Tells dev-server to not to try to reconnect the client. - --client-web-socket-transport Allows to set custom web socket transport to communicate with dev server. - --client-web-socket-url Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to). - --client-web-socket-url-hostname Tells clients connected to devServer to use the provided hostname. - --client-web-socket-url-pathname Tells clients connected to devServer to use the provided path to connect. - --client-web-socket-url-password Tells clients connected to devServer to use the provided password to authenticate. - --client-web-socket-url-port Tells clients connected to devServer to use the provided port. - --client-web-socket-url-protocol Tells clients connected to devServer to use the provided protocol. - --client-web-socket-url-username Tells clients connected to devServer to use the provided username to authenticate. - --compress Enables gzip compression for everything served. - --no-compress Disables gzip compression for everything served. - --history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API. - --no-history-api-fallback Disallows to proxy requests through a specified index page. - --host Allows to specify a hostname to use. - --hot [value] Enables Hot Module Replacement. - --no-hot Disables Hot Module Replacement. - --ipc [value] Listen to a unix socket. - --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default). - --no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default). - --open [value...] Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --no-open Does not open the default browser. - --open-target Opens specified page in browser. - --open-app-name Open specified browser. - --open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser. - --open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser. - --port Allows to specify a port to use. - --server-type Allows to set server and options (by default 'http'). - --server-options-passphrase Passphrase for a pfx file. - --server-options-request-cert Request for an SSL certificate. - --no-server-options-request-cert Does not request for an SSL certificate. - --server-options-ca Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-ca-reset Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-cert Path to an SSL certificate or content of an SSL certificate. - --server-options-cert-reset Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate. - --server-options-crl Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-crl-reset Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-key Path to an SSL key or content of an SSL key. - --server-options-key-reset Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key. - --server-options-pfx Path to an SSL pfx file or content of an SSL pfx file. - --server-options-pfx-reset Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. - --static [value...] Allows to configure options for serving static files from directory (by default 'public' directory). - --no-static Disallows to configure options for serving static files from directory. - --static-directory Directory for static contents. - --static-public-path The static files will be available in the browser under this public path. - --static-serve-index Tells dev server to use serveIndex middleware when enabled. - --no-static-serve-index Does not tell dev server to use serveIndex middleware. - --static-watch Watches for files in static content directory. - --no-static-watch Does not watch for files in static content directory. - --static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory). - --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path. - --watch-files Allows to configure list of globs/directories/files to watch for file changes. - --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Negative 'watch-options-stdin' option. - --allowed-hosts Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --bonjour Allows to broadcasts dev server via ZeroConf networking on start. - --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start. - --no-client Disables client script. - --client-logging Allows to set log level in the browser. - --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings. - --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors. - --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors. - --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings. - --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings. - --client-overlay-runtime-errors Enables a full-screen overlay in the browser when there are uncaught runtime errors. - --no-client-overlay-runtime-errors Disables the full-screen overlay in the browser when there are uncaught runtime errors. - --client-overlay-trusted-types-policy-name The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'. - --client-progress [value] Displays compilation progress in the browser. Options include 'linear' and 'circular' for visual indicators. - --no-client-progress Does not display compilation progress in the browser. - --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client. - --no-client-reconnect Tells dev-server to not to try to reconnect the client. - --client-web-socket-transport Allows to set custom web socket transport to communicate with dev server. - --client-web-socket-url Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to). - --client-web-socket-url-hostname Tells clients connected to devServer to use the provided hostname. - --client-web-socket-url-pathname Tells clients connected to devServer to use the provided path to connect. - --client-web-socket-url-password Tells clients connected to devServer to use the provided password to authenticate. - --client-web-socket-url-port Tells clients connected to devServer to use the provided port. - --client-web-socket-url-protocol Tells clients connected to devServer to use the provided protocol. - --client-web-socket-url-username Tells clients connected to devServer to use the provided username to authenticate. - --compress Enables gzip compression for everything served. - --no-compress Disables gzip compression for everything served. - --history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API. - --no-history-api-fallback Disallows to proxy requests through a specified index page. - --host Allows to specify a hostname to use. - --hot [value] Enables Hot Module Replacement. - --no-hot Disables Hot Module Replacement. - --ipc [value] Listen to a unix socket. - --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default). - --no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default). - --open [value...] Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --no-open Does not open the default browser. - --open-target Opens specified page in browser. - --open-app-name Open specified browser. - --open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser. - --open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser. - --port Allows to specify a port to use. - --server-type Allows to set server and options (by default 'http'). - --server-options-passphrase Passphrase for a pfx file. - --server-options-request-cert Request for an SSL certificate. - --no-server-options-request-cert Does not request for an SSL certificate. - --server-options-ca Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-ca-reset Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-cert Path to an SSL certificate or content of an SSL certificate. - --server-options-cert-reset Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate. - --server-options-crl Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-crl-reset Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-key Path to an SSL key or content of an SSL key. - --server-options-key-reset Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key. - --server-options-pfx Path to an SSL pfx file or content of an SSL pfx file. - --server-options-pfx-reset Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. - --static [value...] Allows to configure options for serving static files from directory (by default 'public' directory). - --no-static Disallows to configure options for serving static files from directory. - --static-directory Directory for static contents. - --static-public-path The static files will be available in the browser under this public path. - --static-serve-index Tells dev server to use serveIndex middleware when enabled. - --no-static-serve-index Does not tell dev server to use serveIndex middleware. - --static-watch Watches for files in static content directory. - --no-static-watch Does not watch for files in static content directory. - --static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory). - --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path. - --watch-files Allows to configure list of globs/directories/files to watch for file changes. - --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - --no-amd Negative 'amd' option. - --bail Report the first error as a hard error instead of tolerating it. - --no-bail Negative 'bail' option. - --cache Enable in memory caching. Disable caching. - --no-cache Negative 'cache' option. - --cache-cache-unaffected Additionally cache computation of modules that are unchanged and reference only unchanged modules. - --no-cache-cache-unaffected Negative 'cache-cache-unaffected' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Negative 'watch-options-stdin' option. - --allowed-hosts Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). - --bonjour Allows to broadcasts dev server via ZeroConf networking on start. - --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start. - --no-client Disables client script. - --client-logging Allows to set log level in the browser. - --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings. - --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors. - --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors. - --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings. - --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings. - --client-overlay-runtime-errors Enables a full-screen overlay in the browser when there are uncaught runtime errors. - --no-client-overlay-runtime-errors Disables the full-screen overlay in the browser when there are uncaught runtime errors. - --client-overlay-trusted-types-policy-name The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'. - --client-progress [value] Displays compilation progress in the browser. Options include 'linear' and 'circular' for visual indicators. - --no-client-progress Does not display compilation progress in the browser. - --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client. - --no-client-reconnect Tells dev-server to not to try to reconnect the client. - --client-web-socket-transport Allows to set custom web socket transport to communicate with dev server. - --client-web-socket-url Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to). - --client-web-socket-url-hostname Tells clients connected to devServer to use the provided hostname. - --client-web-socket-url-pathname Tells clients connected to devServer to use the provided path to connect. - --client-web-socket-url-password Tells clients connected to devServer to use the provided password to authenticate. - --client-web-socket-url-port Tells clients connected to devServer to use the provided port. - --client-web-socket-url-protocol Tells clients connected to devServer to use the provided protocol. - --client-web-socket-url-username Tells clients connected to devServer to use the provided username to authenticate. - --compress Enables gzip compression for everything served. - --no-compress Disables gzip compression for everything served. - --history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API. - --no-history-api-fallback Disallows to proxy requests through a specified index page. - --host Allows to specify a hostname to use. - --hot [value] Enables Hot Module Replacement. - --no-hot Disables Hot Module Replacement. - --ipc [value] Listen to a unix socket. - --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default). - --no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default). - --open [value...] Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --no-open Does not open the default browser. - --open-target Opens specified page in browser. - --open-app-name Open specified browser. - --open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser). - --open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser. - --open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser. - --port Allows to specify a port to use. - --server-type Allows to set server and options (by default 'http'). - --server-options-passphrase Passphrase for a pfx file. - --server-options-request-cert Request for an SSL certificate. - --no-server-options-request-cert Does not request for an SSL certificate. - --server-options-ca Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-ca-reset Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. - --server-options-cert Path to an SSL certificate or content of an SSL certificate. - --server-options-cert-reset Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate. - --server-options-crl Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-crl-reset Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). - --server-options-key Path to an SSL key or content of an SSL key. - --server-options-key-reset Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key. - --server-options-pfx Path to an SSL pfx file or content of an SSL pfx file. - --server-options-pfx-reset Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. - --static [value...] Allows to configure options for serving static files from directory (by default 'public' directory). - --no-static Disallows to configure options for serving static files from directory. - --static-directory Directory for static contents. - --static-public-path The static files will be available in the browser under this public path. - --static-serve-index Tells dev server to use serveIndex middleware when enabled. - --no-static-serve-index Does not tell dev server to use serveIndex middleware. - --static-watch Watches for files in static content directory. - --no-static-watch Does not watch for files in static content directory. - --static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory). - --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path. - --watch-files Allows to configure list of globs/directories/files to watch for file changes. - --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - --no-amd Negative 'amd' option. - --bail Report the first error as a hard error instead of tolerating it. - --no-bail Negative 'bail' option. - --cache Enable in memory caching. Disable caching. - --no-cache Negative 'cache' option. - --cache-cache-unaffected Additionally cache computation of modules that are unchanged and reference only unchanged modules. - --no-cache-cache-unaffected Negative 'cache-cache-unaffected' option. - --cache-max-generations Number of generations unused cache entries stay in memory cache - at stack. - --watch-options-poll [value] \`number\`: use polling with specified interval. \`true\`: use polling. - --no-watch-options-poll Negative 'watch-options-poll' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - --no-amd Negative 'amd' option. - --bail Report the first error as a hard error instead of tolerating it. - --no-bail Negative 'bail' option. - --cache Enable in memory caching. Disable caching. - --no-cache Negative 'cache' option. - --cache-cache-unaffected Additionally cache computation of modules that are unchanged and reference only unchanged modules. - --no-cache-cache-unaffected Negative 'cache-cache-unaffected' option. - --cache-max-generations Number of generations unused cache entries stay in memory cache - at stack. - --watch-options-poll [value] \`number\`: use polling with specified interval. \`true\`: use polling. - --no-watch-options-poll Negative 'watch-options-poll' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - --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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -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. - info|i [options] Outputs information about your system. - serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. - version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - 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/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -The build tool for modern web applications. -... -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -The build tool for modern web applications. -... -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -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. - info|i [options] Outputs information about your system. - serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. - version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - 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/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help --cache-type" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help --cache-type" option: stdout 1`] = ` -"Usage: webpack --cache-type -Description: In memory caching. Filesystem caching. -Possible values: 'memory' | 'filesystem' - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help --color" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help --color" option: stdout 1`] = ` -"Usage: webpack --color -Description: Enable colors on console. - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help --mode" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help --mode" option: stdout 1`] = ` -"Usage: webpack --mode -Description: Enable production optimizations or development hints. -Possible values: 'development' | 'production' | 'none' - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help --no-color" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help --no-color" option: stdout 1`] = ` -"Usage: webpack --no-color -Description: Disable colors on console. - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help --no-stats" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help --no-stats" option: stdout 1`] = ` -"Usage: webpack --no-stats -Description: Negative 'stats' option. - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help --output-chunk-format" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help --output-chunk-format" option: stdout 1`] = ` -"Usage: webpack --output-chunk-format -Description: The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), 'module' (ESM), but others might be added by plugins). -Possible values: 'array-push' | 'commonjs' | 'module' | false - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help --stats" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help --stats" option: stdout 1`] = ` -"Usage: webpack --stats [value] -Description: Stats options object or preset name. -Possible values: 'none' | 'summary' | 'errors-only' | 'errors-warnings' | 'minimal' | 'normal' | 'detailed' | 'verbose' - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help --target" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help --target" option: stdout 1`] = ` -"Usage: webpack --target -Short: webpack -t -Description: Environment to build for. Environment to build for. An array of environments to build for all of them when possible. -Possible values: false - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help --version" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help --version" option: stdout 1`] = ` -"Usage: webpack --version -Short: webpack -v -Description: Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help -v" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help -v" option: stdout 1`] = ` -"Usage: webpack --version -Short: webpack -v -Description: Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help serve --color" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help serve --color" option: stdout 1`] = ` -"Usage: webpack serve --color -Description: Enable colors on console. - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help serve --mode" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help serve --mode" option: stdout 1`] = ` -"Usage: webpack serve --mode -Description: Enable production optimizations or development hints. -Possible values: 'development' | 'production' | 'none' - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; - -exports[`help should show help information using the "help serve --no-color" option: stderr 1`] = `""`; - -exports[`help should show help information using the "help serve --no-color" option: stdout 1`] = ` -"Usage: webpack serve --no-color -Description: Disable colors on console. - -To see list of all supported commands and options run 'webpack --help=verbose'. - -Webpack documentation: https://webpack.js.org/. -CLI documentation: https://webpack.js.org/api/cli/. -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] - -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 commands. - -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/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." -`; +exports[`help should log error for invalid flag with the "--help" option #3 1`] = `"[webpack-cli] Unknown value for '--help' option, please use '--help=verbose'"`; exports[`help should show the same information using the "--help" option and command syntax: stderr from command syntax 1`] = `""`; 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] - -The build tool for modern web applications. +"Usage: webpack [options] [command] 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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -h, --help [verbose] Display help for commands and options. + -v, --version Outputs information about your system. + --help [verbosity] Display help for command + --color Enable colors on console. + --no-color Disable colors on console. + -h display help for command 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. - info|i [options] Outputs information about your system. - serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. - version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - 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/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." + build|bundle [options] [entries...] Run webpack (default command, can be + omitted). + watch|w [options] [entries...] Run webpack and watch for files changes. + configtest|t [config-path] Validate a webpack configuration. + serve|server [options] [entries...] Run the webpack dev server and watch for + source file changes while serving. + info|i [options] Outputs information about your system. + help [command] display help for command" `; 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] - -The build tool for modern web applications. +"Usage: webpack [options] [command] 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'. - --disable-interpret Disable interpret for loading the config file. - --env Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval". - --node-env Sets process.env.NODE_ENV to the specified value for access within the configuration.(Deprecated: Use '--config-node-env' instead) - --config-node-env Sets process.env.NODE_ENV to the specified value for access within the configuration. - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. - --progress [value] Print compilation progress during build. - -j, --json [pathToJsonFile] Prints result as JSON or store it in a file. - --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack. - -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). - --no-devtool Negative 'devtool' option. - --entry A module that is loaded upon startup. Only the last one is exported. - -e, --extends Path to the configuration to be extended (only works when using webpack-cli). - --mode Enable production optimizations or development hints. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path The output directory as **absolute path** (required). - --stats [value] Stats options object or preset name. - --no-stats Negative 'stats' option. - -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. - --no-target Negative 'target' option. - -w, --watch Enter watch mode, which rebuilds on file change. - --no-watch Negative 'watch' option. - --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 commands. - -h, --help [verbose] Display help for commands and options. + -v, --version Outputs information about your system. + --help [verbosity] Display help for command + --color Enable colors on console. + --no-color Disable colors on console. + -h display help for command 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. - info|i [options] Outputs information about your system. - serve|server|s [entries...] [options] Run the webpack dev server and watch for source file changes while serving. - version|v [options] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - 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/. -CLI documentation: https://webpack.js.org/api/cli/. -Made with ♥ by the webpack team." + build|bundle [options] [entries...] Run webpack (default command, can be + omitted). + watch|w [options] [entries...] Run webpack and watch for files changes. + configtest|t [config-path] Validate a webpack configuration. + serve|server [options] [entries...] Run the webpack dev server and watch for + source file changes while serving. + info|i [options] Outputs information about your system. + help [command] display help for command" `; diff --git a/test/help/help.test.js b/test/help/help.test.js index b8d844a7c1d..83a6030bc1c 100644 --- a/test/help/help.test.js +++ b/test/help/help.test.js @@ -1,53 +1,8 @@ "use strict"; -const path = require("node:path"); -const { pathToFileURL } = require("node:url"); const { normalizeStderr, normalizeStdout, run } = require("../utils/test-utils"); -const nodeOptions = [`--import=${pathToFileURL(path.resolve(__dirname, "./set-blocking.js"))}`]; - describe("help", () => { - it('should show help information using the "--help" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["--help"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "--help" option with the "verbose" value', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "verbose"], { - nodeOptions, - }); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - // Since the output file is very large, let's make sure we have a header and footer. - expect( - `${normalizeStdout(stdout.slice(0, 145))}\n...\n${normalizeStdout(stdout.slice(-132))}`, - ).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "--help" option with the "verbose" value #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["--help=verbose"], { - nodeOptions, - }); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect( - `${normalizeStdout(stdout.slice(0, 145))}\n...\n${normalizeStdout(stdout.slice(-132))}`, - ).toMatchSnapshot("stdout"); - }); - - it("should show help information using command syntax", async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - it('should show the same information using the "--help" option and command syntax', async () => { const { exitCode: exitCodeFromOption, @@ -69,359 +24,8 @@ describe("help", () => { expect(normalizeStdout(stdoutFromCommandSyntax)).toMatchSnapshot("stdout from command syntax"); }); - it('should show help information and respect the "--color" flag using the "--help" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "--color"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(stdout).toContain("\u001B[1m"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information and respect the "--no-color" flag using the "--help" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "--no-color"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - const commands = [ - { - name: "info", - alias: "i", - }, - { - name: "configtest", - alias: "t", - }, - { - name: "watch", - alias: "w", - }, - { - name: "serve", - alias: ["server", "s"], - }, - { - name: "build", - alias: "b", - }, - ]; - - for (const { name, alias } of commands) { - it(`should show help information for '${name}' command using the "--help" option`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [name, "--help"], { - nodeOptions, - }); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it(`should show help information for '${name}' command using the "--help verbose" option`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [name, "--help", "verbose"], { - nodeOptions, - }); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it(`should show help information for '${name}' command using command syntax`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", name], { - nodeOptions, - }); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it(`should show help information for '${name}' and respect the "--color" flag using the "--help" option`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [name, "--help", "--color"], { - nodeOptions, - }); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(stdout).toContain("\u001B[1m"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it(`should show help information for '${name}' and respect the "--no-color" flag using the "--help" option`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [name, "--help", "--no-color"], { - nodeOptions, - }); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(stdout).not.toContain("\u001B[1m"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - const aliases = Array.isArray(alias) ? alias : [alias]; - - for (const alias of aliases) { - it(`should show help information for '${alias}' command using the "--help" option`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [alias, "--help"], { - nodeOptions, - }); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it(`should show help information for '${alias}' command using the "--help verbose" option`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [alias, "--help", "verbose"], { - nodeOptions, - }); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it(`should show help information for '${alias}' command using command syntax`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", alias], { - nodeOptions, - }); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - } - } - - it("should show help information with options for sub commands", async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["info", "--help"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information and taking precedence when "--help" and "--version" option using together', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "--version"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help --mode" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--mode"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help --target" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--target"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help --stats" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--stats"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help --cache-type" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--cache-type"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help --output-chunk-format" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--output-chunk-format"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help --no-stats" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--no-stats"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help serve --mode" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "serve", "--mode"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help --color" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--color"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(stdout).toContain("\u001B[1m"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help --no-color" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--no-color"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help serve --color" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "serve", "--color"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(stdout).toContain("\u001B[1m"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help serve --no-color" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "serve", "--no-color"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help --version" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--version"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should show help information using the "help -v" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "-v"]); - - expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should log error for invalid command using the "--help" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "myCommand"]); - - expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should log error for invalid command using the "--help" option #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["--flag", "--help"]); - - expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should log error for invalid command using the "--help" option #3', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["serve", "--flag", "--help"]); - - expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it("should log error for unknown command using command syntax", async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "myCommand"]); - - expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it("should log error for unknown command using command syntax #2", async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "verbose"]); - - expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it("should log error for unknown option using command syntax #2", async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--made"]); - - expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it("should log error for unknown option using command syntax #3", async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "serve", "--made"]); - - expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it("should log error for unknown option using command syntax #4", async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "bui", "--mode"]); - - expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it("should log error for invalid command using command syntax #3", async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--mode", "serve"]); - - expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it("should log error for invalid command using command syntax #4", async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [ - "help", - "serve", - "--mode", - "--mode", - ]); - - expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should log error for invalid flag with the "--help" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "--my-flag"]); - - expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - - it('should log error for invalid flag with the "--help" option #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "init", "info"]); - - expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); - expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); - }); - it('should log error for invalid flag with the "--help" option #3', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ["--help="]); + const { exitCode, stderr, stdout } = await run(__dirname, ["--help=invalid"]); expect(exitCode).toBe(2); expect(stderr).toMatchSnapshot(); diff --git a/test/help/set-blocking.js b/test/help/set-blocking.js deleted file mode 100644 index ba4ceb39891..00000000000 --- a/test/help/set-blocking.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; - -process.stdout._handle.setBlocking(true); From 9c127f323d5a71b8f2c2dcfb188e0d44d4d5dd79 Mon Sep 17 00:00:00 2001 From: Aviv Keller Date: Sat, 31 Jan 2026 13:46:29 -0500 Subject: [PATCH 2/2] fixup! --- packages/webpack-cli/src/bootstrap.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/webpack-cli/src/bootstrap.ts b/packages/webpack-cli/src/bootstrap.ts index 9ee370fe6a2..e9a3ea3d322 100644 --- a/packages/webpack-cli/src/bootstrap.ts +++ b/packages/webpack-cli/src/bootstrap.ts @@ -17,6 +17,3 @@ export default runCLI; // TODO remove me in the next major release and use `default` export module.exports = runCLI; - -// @ts-expect-error ... -if (process.env.npm_lifecycle_script === "tsx") runCLI();