Skip to content

Commit 9d07d67

Browse files
fix: update usage info (#2594)
1 parent 4617050 commit 9d07d67

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

OPTIONS.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -859,9 +859,9 @@ Commands:
859859
help|h [command] [option] Display help for commands and options.
860860
info|i [options] Outputs information about your system.
861861
init|c [generation-path] [options] Initialize a new webpack project.
862-
loader|l [output-path] Scaffold a loader.
862+
loader|l [output-path] [options] Scaffold a loader.
863863
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
864-
plugin|p [output-path] Scaffold a plugin.
864+
plugin|p [output-path] [options] Scaffold a plugin.
865865
serve|s [entries...] [options] Run the webpack dev server.
866866
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
867867
watch|w [entries...] [options] Run webpack and watch for files changes.

packages/generators/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class GeneratorsCommand {
7777
name: 'plugin [output-path]',
7878
alias: 'p',
7979
description: 'Scaffold a plugin.',
80-
usage: '[output-path]',
80+
usage: '[output-path] [options]',
8181
pkg: '@webpack-cli/generators',
8282
},
8383
[

packages/webpack-cli/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ npx webpack-cli --help verbose
6868
help|h [command] [option] Display help for commands and options.
6969
info|i [options] Outputs information about your system.
7070
init|c [generation-path] [options] Initialize a new webpack project.
71-
loader|l [output-path] Scaffold a loader.
71+
loader|l [output-path] [options] Scaffold a loader.
7272
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
73-
plugin|p [output-path] Scaffold a plugin.
73+
plugin|p [output-path] [options] Scaffold a plugin.
7474
serve|s [entries...] [options] Run the webpack dev server.
7575
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
7676
watch|w [entries...] [options] Run webpack and watch for files changes.

test/help/__snapshots__/help.test.js.snap.webpack4

+1-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ Made with ♥ by the webpack team."
375375
`;
376376

377377
exports[`help should show help information for 'plugin' command using the "--help" option 1`] = `
378-
"Usage: webpack plugin|p [output-path]
378+
"Usage: webpack plugin|p [output-path] [options]
379379

380380
Scaffold a plugin.
381381

test/help/__snapshots__/help.test.js.snap.webpack5

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ Made with ♥ by the webpack team."
383383
`;
384384

385385
exports[`help should show help information for 'plugin' command using the "--help" option 1`] = `
386-
"Usage: webpack plugin|p [output-path]
386+
"Usage: webpack plugin|p [output-path] [options]
387387

388388
Scaffold a plugin.
389389

test/help/help.test.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -82,51 +82,51 @@ describe('help', () => {
8282
{
8383
name: 'init',
8484
alias: 'c',
85-
helpOutput: 'webpack init|c [generation-path] [options]',
85+
usage: 'webpack init|c [generation-path] [options]',
8686
},
8787
{
8888
name: 'info',
8989
alias: 'i',
90-
helpOutput: 'webpack info|i [options]',
90+
usage: 'webpack info|i [options]',
9191
},
9292
{
9393
name: 'loader',
9494
alias: 'l',
95-
helpOutput: 'webpack loader|l [output-path]',
95+
usage: 'webpack loader|l [output-path] [options]',
9696
},
9797
{
9898
name: 'migrate',
9999
alias: 'm',
100-
helpOutput: 'webpack migrate|m <config-path> [new-config-path]',
100+
usage: 'webpack migrate|m <config-path> [new-config-path]',
101101
},
102102
{
103103
name: 'plugin',
104104
alias: 'p',
105-
helpOutput: 'webpack plugin|p [output-path]',
105+
usage: 'webpack plugin|p [output-path] [options]',
106106
},
107107
{
108108
name: 'configtest',
109109
alias: 't',
110-
helpOutput: 'webpack configtest|t [config-path]',
110+
usage: 'webpack configtest|t [config-path]',
111111
},
112112
{
113113
name: 'watch',
114114
alias: 'w',
115-
helpOutput: 'webpack watch|w [entries...] [options]',
115+
usage: 'webpack watch|w [entries...] [options]',
116116
},
117117
{
118118
name: 'serve',
119119
alias: 's',
120-
helpOutput: 'webpack serve|s [entries...] [options]',
120+
usage: 'webpack serve|s [entries...] [options]',
121121
},
122122
{
123123
name: 'build',
124124
alias: 'b',
125-
helpOutput: 'webpack build|bundle|b [entries...] [options]',
125+
usage: 'webpack build|bundle|b [entries...] [options]',
126126
},
127127
];
128128

129-
commands.forEach(({ name, alias, helpOutput }) => {
129+
commands.forEach(({ name, alias, usage }) => {
130130
it(`should show help information for '${name}' command using the "--help" option`, async () => {
131131
const { exitCode, stderr, stdout } = await run(__dirname, [name, '--help']);
132132

@@ -141,39 +141,39 @@ describe('help', () => {
141141

142142
expect(exitCode).toBe(0);
143143
expect(stderr).toBeFalsy();
144-
expect(stdout).toContain(helpOutput);
144+
expect(stdout).toContain(usage);
145145
});
146146

147147
it(`should show help information for '${name}' command using command syntax`, async () => {
148148
const { exitCode, stderr, stdout } = await run(__dirname, ['help', name]);
149149

150150
expect(exitCode).toBe(0);
151151
expect(stderr).toBeFalsy();
152-
expect(stdout).toContain(helpOutput);
152+
expect(stdout).toContain(usage);
153153
});
154154

155155
it(`should show help information for '${alias}' command using the "--help" option`, async () => {
156156
const { exitCode, stderr, stdout } = await run(__dirname, [alias, '--help']);
157157

158158
expect(exitCode).toBe(0);
159159
expect(stderr).toBeFalsy();
160-
expect(stdout).toContain(helpOutput);
160+
expect(stdout).toContain(usage);
161161
});
162162

163163
it(`should show help information for '${alias}' command using the "--help verbose" option`, async () => {
164164
const { exitCode, stderr, stdout } = await run(__dirname, [alias, '--help', 'verbose']);
165165

166166
expect(exitCode).toBe(0);
167167
expect(stderr).toBeFalsy();
168-
expect(stdout).toContain(helpOutput);
168+
expect(stdout).toContain(usage);
169169
});
170170

171171
it(`should show help information for '${alias}' command using command syntax`, async () => {
172172
const { exitCode, stderr, stdout } = await run(__dirname, ['help', alias]);
173173

174174
expect(exitCode).toBe(0);
175175
expect(stderr).toBeFalsy();
176-
expect(stdout).toContain(helpOutput);
176+
expect(stdout).toContain(usage);
177177
});
178178

179179
it(`should show help information for '${name}' and respect the "--color" flag using the "--help" option`, async () => {
@@ -182,7 +182,7 @@ describe('help', () => {
182182
expect(exitCode).toBe(0);
183183
expect(stderr).toBeFalsy();
184184
expect(stdout).toContain('\x1b[1m');
185-
expect(stdout).toContain(helpOutput);
185+
expect(stdout).toContain(usage);
186186

187187
if (!isMacOS) {
188188
expect(stdout).toContain('Made with ♥ by the webpack team');
@@ -195,7 +195,7 @@ describe('help', () => {
195195
expect(exitCode).toBe(0);
196196
expect(stderr).toBeFalsy();
197197
expect(stdout).not.toContain('\x1b[1m');
198-
expect(stdout).toContain(helpOutput);
198+
expect(stdout).toContain(usage);
199199

200200
if (!isMacOS) {
201201
expect(stdout).toContain('Made with ♥ by the webpack team');

0 commit comments

Comments
 (0)