Skip to content

Commit c9ee947

Browse files
authored
feat: add server alias for serve command (#2631)
1 parent 7673aad commit c9ee947

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

OPTIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ Commands:
873873
loader|l [output-path] [options] Scaffold a loader.
874874
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
875875
plugin|p [output-path] [options] Scaffold a plugin.
876-
serve|s [entries...] [options] Run the webpack dev server.
876+
serve|server|s [entries...] [options] Run the webpack dev server.
877877
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
878878
watch|w [entries...] [options] Run webpack and watch for files changes.
879879

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Thus, webpack CLI provides different commands for many common tasks.
6363
- [`migrate|m <config-path> [new-config-path]`](https://www.npmjs.com/package/@webpack-cli/migrate) - Migrate project from one version to another.
6464
- [`plugin|p [output-path] [options]`](./packages/generators#generators) - Initiate new plugin project.
6565
- [`loader|l [output-path] [options]`](./packages/generators#generators) - Initiate new loader project.
66-
- [`serve|s [entries...] [options]`](./packages/serve/README.md#webpack-cli-serve) - Use webpack with a development server that provides live reloading.
66+
- [`serve|server|s [entries...] [options]`](./packages/serve/README.md#webpack-cli-serve) - Use webpack with a development server that provides live reloading.
6767
- `version|v [commands...]` - Output the version number of `webpack`, `webpack-cli`, `webpack-dev-server`, and commands
6868
- `watch|w [entries...] [options]` - Run webpack and watch for files changes.
6969

SERVE-OPTIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
```
2-
Usage: webpack serve|s [entries...] [options]
2+
Usage: webpack serve|server|s [entries...] [options]
33
44
Run the webpack dev server.
55

packages/serve/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ServeCommand {
88
await cli.makeCommand(
99
{
1010
name: 'serve [entries...]',
11-
alias: 's',
11+
alias: ['server', 's'],
1212
description: 'Run the webpack dev server.',
1313
usage: '[entries...] [options]',
1414
pkg: '@webpack-cli/serve',

packages/webpack-cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ npx webpack-cli --help verbose
7171
loader|l [output-path] [options] Scaffold a loader.
7272
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
7373
plugin|p [output-path] [options] Scaffold a plugin.
74-
serve|s [entries...] [options] Run the webpack dev server.
74+
serve|server|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.
7777
```

packages/webpack-cli/lib/webpack-cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ class WebpackCLI {
644644
const externalBuiltInCommandsInfo = [
645645
{
646646
name: 'serve [entries...]',
647-
alias: 's',
647+
alias: ['server', 's'],
648648
pkg: '@webpack-cli/serve',
649649
},
650650
{

test/build/unknown/unknown.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,11 @@ describe('unknown behaviour', () => {
219219
});
220220

221221
it('should log error and provide suggestion if an unknown command passed', async () => {
222-
const { exitCode, stderr, stdout } = await run(__dirname, ['server'], true, [], { TERM_PROGRAM: false });
222+
const { exitCode, stderr, stdout } = await run(__dirname, ['serverr'], true, [], { TERM_PROGRAM: false });
223223

224224
expect(exitCode).toBe(2);
225-
expect(stderr).toContain("Unknown command or entry 'server'");
226-
expect(stderr).toContain("Did you mean 'serve' (alias 's')?");
225+
expect(stderr).toContain("Unknown command or entry 'serverr'");
226+
expect(stderr).toContain("Did you mean 'serve' (alias 'server, s')?");
227227
expect(stderr).toContain("Run 'webpack --help' to see available commands and options");
228228
expect(stdout).toBeFalsy();
229229
});

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Commands:
102102
loader|l [output-path] [options] Scaffold a loader.
103103
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
104104
plugin|p [output-path] [options] Scaffold a plugin.
105-
serve|s [entries...] [options] Run the webpack dev server.
105+
serve|server|s [entries...] [options] Run the webpack dev server.
106106
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
107107
watch|w [entries...] [options] Run webpack and watch for files changes.
108108

@@ -156,7 +156,7 @@ Commands:
156156
loader|l [output-path] [options] Scaffold a loader.
157157
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
158158
plugin|p [output-path] [options] Scaffold a plugin.
159-
serve|s [entries...] [options] Run the webpack dev server.
159+
serve|server|s [entries...] [options] Run the webpack dev server.
160160
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
161161
watch|w [entries...] [options] Run webpack and watch for files changes.
162162

@@ -210,7 +210,7 @@ Commands:
210210
loader|l [output-path] [options] Scaffold a loader.
211211
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
212212
plugin|p [output-path] [options] Scaffold a plugin.
213-
serve|s [entries...] [options] Run the webpack dev server.
213+
serve|server|s [entries...] [options] Run the webpack dev server.
214214
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
215215
watch|w [entries...] [options] Run webpack and watch for files changes.
216216

@@ -400,7 +400,7 @@ Made with ♥ by the webpack team."
400400
`;
401401

402402
exports[`help should show help information for 'serve' command using the "--help" option 1`] = `
403-
"Usage: webpack serve|s [entries...] [options]
403+
"Usage: webpack serve|server|s [entries...] [options]
404404

405405
Run the webpack dev server.
406406

@@ -572,7 +572,7 @@ Commands:
572572
loader|l [output-path] [options] Scaffold a loader.
573573
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
574574
plugin|p [output-path] [options] Scaffold a plugin.
575-
serve|s [entries...] [options] Run the webpack dev server.
575+
serve|server|s [entries...] [options] Run the webpack dev server.
576576
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
577577
watch|w [entries...] [options] Run webpack and watch for files changes.
578578

@@ -626,7 +626,7 @@ Commands:
626626
loader|l [output-path] [options] Scaffold a loader.
627627
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
628628
plugin|p [output-path] [options] Scaffold a plugin.
629-
serve|s [entries...] [options] Run the webpack dev server.
629+
serve|server|s [entries...] [options] Run the webpack dev server.
630630
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
631631
watch|w [entries...] [options] Run webpack and watch for files changes.
632632

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Commands:
103103
loader|l [output-path] [options] Scaffold a loader.
104104
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
105105
plugin|p [output-path] [options] Scaffold a plugin.
106-
serve|s [entries...] [options] Run the webpack dev server.
106+
serve|server|s [entries...] [options] Run the webpack dev server.
107107
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
108108
watch|w [entries...] [options] Run webpack and watch for files changes.
109109

@@ -158,7 +158,7 @@ Commands:
158158
loader|l [output-path] [options] Scaffold a loader.
159159
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
160160
plugin|p [output-path] [options] Scaffold a plugin.
161-
serve|s [entries...] [options] Run the webpack dev server.
161+
serve|server|s [entries...] [options] Run the webpack dev server.
162162
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
163163
watch|w [entries...] [options] Run webpack and watch for files changes.
164164

@@ -213,7 +213,7 @@ Commands:
213213
loader|l [output-path] [options] Scaffold a loader.
214214
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
215215
plugin|p [output-path] [options] Scaffold a plugin.
216-
serve|s [entries...] [options] Run the webpack dev server.
216+
serve|server|s [entries...] [options] Run the webpack dev server.
217217
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
218218
watch|w [entries...] [options] Run webpack and watch for files changes.
219219

@@ -404,7 +404,7 @@ Made with ♥ by the webpack team."
404404
`;
405405

406406
exports[`help should show help information for 'serve' command using the "--help" option 1`] = `
407-
"Usage: webpack serve|s [entries...] [options]
407+
"Usage: webpack serve|server|s [entries...] [options]
408408

409409
Run the webpack dev server.
410410

@@ -579,7 +579,7 @@ Commands:
579579
loader|l [output-path] [options] Scaffold a loader.
580580
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
581581
plugin|p [output-path] [options] Scaffold a plugin.
582-
serve|s [entries...] [options] Run the webpack dev server.
582+
serve|server|s [entries...] [options] Run the webpack dev server.
583583
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
584584
watch|w [entries...] [options] Run webpack and watch for files changes.
585585

@@ -634,7 +634,7 @@ Commands:
634634
loader|l [output-path] [options] Scaffold a loader.
635635
migrate|m <config-path> [new-config-path] Migrate a configuration to a new version.
636636
plugin|p [output-path] [options] Scaffold a plugin.
637-
serve|s [entries...] [options] Run the webpack dev server.
637+
serve|server|s [entries...] [options] Run the webpack dev server.
638638
version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
639639
watch|w [entries...] [options] Run webpack and watch for files changes.
640640

test/help/help.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ describe('help', () => {
108108
},
109109
{
110110
name: 'serve',
111-
alias: 's',
112-
usage: 'webpack serve|s [entries...] [options]',
111+
alias: ['server', 's'],
112+
usage: 'webpack serve|server|s [entries...] [options]',
113113
},
114114
{
115115
name: 'build',

0 commit comments

Comments
 (0)