From 9d07d67faf147cbaf0dddb95038403963e5f2afb Mon Sep 17 00:00:00 2001 From: James George Date: Mon, 5 Apr 2021 19:47:02 +0530 Subject: [PATCH] fix: update usage info (#2594) --- OPTIONS.md | 4 +-- packages/generators/src/index.ts | 2 +- packages/webpack-cli/README.md | 4 +-- .../__snapshots__/help.test.js.snap.webpack4 | 2 +- .../__snapshots__/help.test.js.snap.webpack5 | 2 +- test/help/help.test.js | 34 +++++++++---------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/OPTIONS.md b/OPTIONS.md index d0ddda43f04..d69cb2e2787 100644 --- a/OPTIONS.md +++ b/OPTIONS.md @@ -859,9 +859,9 @@ Commands: help|h [command] [option] Display help for commands and options. info|i [options] Outputs information about your system. init|c [generation-path] [options] Initialize a new webpack project. - loader|l [output-path] Scaffold a loader. + loader|l [output-path] [options] Scaffold a loader. migrate|m [new-config-path] Migrate a configuration to a new version. - plugin|p [output-path] Scaffold a plugin. + plugin|p [output-path] [options] Scaffold a plugin. serve|s [entries...] [options] Run the webpack dev server. version|v [commands...] 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. diff --git a/packages/generators/src/index.ts b/packages/generators/src/index.ts index 0b46ef4b20c..4d862c0cebe 100644 --- a/packages/generators/src/index.ts +++ b/packages/generators/src/index.ts @@ -77,7 +77,7 @@ class GeneratorsCommand { name: 'plugin [output-path]', alias: 'p', description: 'Scaffold a plugin.', - usage: '[output-path]', + usage: '[output-path] [options]', pkg: '@webpack-cli/generators', }, [ diff --git a/packages/webpack-cli/README.md b/packages/webpack-cli/README.md index 3b9bb4d0810..938112cb981 100644 --- a/packages/webpack-cli/README.md +++ b/packages/webpack-cli/README.md @@ -68,9 +68,9 @@ npx webpack-cli --help verbose help|h [command] [option] Display help for commands and options. info|i [options] Outputs information about your system. init|c [generation-path] [options] Initialize a new webpack project. - loader|l [output-path] Scaffold a loader. + loader|l [output-path] [options] Scaffold a loader. migrate|m [new-config-path] Migrate a configuration to a new version. - plugin|p [output-path] Scaffold a plugin. + plugin|p [output-path] [options] Scaffold a plugin. serve|s [entries...] [options] Run the webpack dev server. version|v [commands...] 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. diff --git a/test/help/__snapshots__/help.test.js.snap.webpack4 b/test/help/__snapshots__/help.test.js.snap.webpack4 index e71a7e96d78..c90d98a555c 100644 --- a/test/help/__snapshots__/help.test.js.snap.webpack4 +++ b/test/help/__snapshots__/help.test.js.snap.webpack4 @@ -375,7 +375,7 @@ Made with ♥ by the webpack team." `; exports[`help should show help information for 'plugin' command using the "--help" option 1`] = ` -"Usage: webpack plugin|p [output-path] +"Usage: webpack plugin|p [output-path] [options] Scaffold a plugin. diff --git a/test/help/__snapshots__/help.test.js.snap.webpack5 b/test/help/__snapshots__/help.test.js.snap.webpack5 index 80b0cd34b91..57f13f638c0 100644 --- a/test/help/__snapshots__/help.test.js.snap.webpack5 +++ b/test/help/__snapshots__/help.test.js.snap.webpack5 @@ -383,7 +383,7 @@ Made with ♥ by the webpack team." `; exports[`help should show help information for 'plugin' command using the "--help" option 1`] = ` -"Usage: webpack plugin|p [output-path] +"Usage: webpack plugin|p [output-path] [options] Scaffold a plugin. diff --git a/test/help/help.test.js b/test/help/help.test.js index 0800341fbe2..979d900452e 100644 --- a/test/help/help.test.js +++ b/test/help/help.test.js @@ -82,51 +82,51 @@ describe('help', () => { { name: 'init', alias: 'c', - helpOutput: 'webpack init|c [generation-path] [options]', + usage: 'webpack init|c [generation-path] [options]', }, { name: 'info', alias: 'i', - helpOutput: 'webpack info|i [options]', + usage: 'webpack info|i [options]', }, { name: 'loader', alias: 'l', - helpOutput: 'webpack loader|l [output-path]', + usage: 'webpack loader|l [output-path] [options]', }, { name: 'migrate', alias: 'm', - helpOutput: 'webpack migrate|m [new-config-path]', + usage: 'webpack migrate|m [new-config-path]', }, { name: 'plugin', alias: 'p', - helpOutput: 'webpack plugin|p [output-path]', + usage: 'webpack plugin|p [output-path] [options]', }, { name: 'configtest', alias: 't', - helpOutput: 'webpack configtest|t [config-path]', + usage: 'webpack configtest|t [config-path]', }, { name: 'watch', alias: 'w', - helpOutput: 'webpack watch|w [entries...] [options]', + usage: 'webpack watch|w [entries...] [options]', }, { name: 'serve', alias: 's', - helpOutput: 'webpack serve|s [entries...] [options]', + usage: 'webpack serve|s [entries...] [options]', }, { name: 'build', alias: 'b', - helpOutput: 'webpack build|bundle|b [entries...] [options]', + usage: 'webpack build|bundle|b [entries...] [options]', }, ]; - commands.forEach(({ name, alias, helpOutput }) => { + commands.forEach(({ name, alias, usage }) => { it(`should show help information for '${name}' command using the "--help" option`, async () => { const { exitCode, stderr, stdout } = await run(__dirname, [name, '--help']); @@ -141,7 +141,7 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain(helpOutput); + expect(stdout).toContain(usage); }); it(`should show help information for '${name}' command using command syntax`, async () => { @@ -149,7 +149,7 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain(helpOutput); + expect(stdout).toContain(usage); }); it(`should show help information for '${alias}' command using the "--help" option`, async () => { @@ -157,7 +157,7 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain(helpOutput); + expect(stdout).toContain(usage); }); it(`should show help information for '${alias}' command using the "--help verbose" option`, async () => { @@ -165,7 +165,7 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain(helpOutput); + expect(stdout).toContain(usage); }); it(`should show help information for '${alias}' command using command syntax`, async () => { @@ -173,7 +173,7 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain(helpOutput); + expect(stdout).toContain(usage); }); it(`should show help information for '${name}' and respect the "--color" flag using the "--help" option`, async () => { @@ -182,7 +182,7 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain('\x1b[1m'); - expect(stdout).toContain(helpOutput); + expect(stdout).toContain(usage); if (!isMacOS) { expect(stdout).toContain('Made with ♥ by the webpack team'); @@ -195,7 +195,7 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).not.toContain('\x1b[1m'); - expect(stdout).toContain(helpOutput); + expect(stdout).toContain(usage); if (!isMacOS) { expect(stdout).toContain('Made with ♥ by the webpack team');