Skip to content

Commit a43e513

Browse files
committed
refactor!: remove the --web-socket-server cli option (#4680)
1 parent a8d3ce2 commit a43e513

File tree

5 files changed

+24
-33
lines changed

5 files changed

+24
-33
lines changed

lib/Server.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2353,7 +2353,6 @@ class Server {
23532353
* @private
23542354
* @returns {void}
23552355
*/
2356-
// TODO: remove `--web-socket-server` in favor of `--web-socket-server-type`
23572356
createWebSocketServer() {
23582357
/** @type {WebSocketServerImplementation | undefined | null} */
23592358
this.webSocketServer = new /** @type {any} */ (this.getServerTransport())(

lib/options.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -894,12 +894,12 @@
894894
}
895895
},
896896
{
897-
"$ref": "#/definitions/WebSocketServerType"
897+
"enum": ["sockjs", "ws"],
898+
"cli": {
899+
"exclude": true
900+
}
898901
}
899-
],
900-
"cli": {
901-
"description": "Deprecated: please use '--web-socket-server-type' option."
902-
}
902+
]
903903
},
904904
"WebSocketServerFunction": {
905905
"instanceof": "Function"
@@ -932,7 +932,10 @@
932932
},
933933
"WebSocketServerString": {
934934
"type": "string",
935-
"minLength": 1
935+
"minLength": 1,
936+
"cli": {
937+
"exclude": true
938+
}
936939
}
937940
},
938941
"additionalProperties": false,

test/cli/__snapshots__/basic.test.js.snap.webpack5

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ Options:
129129
--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.
130130
--watch-files <value...> Allows to configure list of globs/directories/files to watch for file changes.
131131
--watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes.
132-
--web-socket-server <value> Deprecated: please use '--web-socket-server-type' option. Allows to set web socket server and options (by default 'ws').
133132
--no-web-socket-server Disallows to set web socket server and options.
134133
--web-socket-server-type <value> Allows to set web socket server and options (by default 'ws').
135134

test/cli/webSocketServer-option.test.js

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,33 @@ const { testBin } = require("../helpers/test-bin");
44
const port = require("../ports-map")["cli-web-socket-server"];
55

66
describe('"webSocketServer" CLI option', () => {
7-
it('should work using "--web-socket-server sockjs"', async () => {
8-
const { exitCode } = await testBin([
9-
"--port",
10-
port,
11-
"--web-socket-server",
12-
"sockjs",
13-
]);
14-
15-
expect(exitCode).toEqual(0);
16-
});
17-
18-
it('should work using "--web-socket-server ws"', async () => {
7+
it('should work using "--web-socket-server-type ws"', async () => {
198
const { exitCode } = await testBin([
209
"--port",
2110
port,
22-
"--web-socket-server",
11+
"--web-socket-server-type",
2312
"ws",
2413
]);
2514

2615
expect(exitCode).toEqual(0);
2716
});
2817

29-
it('should work using "--web-socket-server-type ws"', async () => {
18+
it('should work using "--web-socket-server-type sockjs"', async () => {
3019
const { exitCode } = await testBin([
3120
"--port",
3221
port,
3322
"--web-socket-server-type",
34-
"ws",
23+
"sockjs",
3524
]);
3625

3726
expect(exitCode).toEqual(0);
3827
});
3928

40-
it('should work using "--web-socket-server-type sockjs"', async () => {
29+
it('should work using "--no-web-socket-server"', async () => {
4130
const { exitCode } = await testBin([
4231
"--port",
4332
port,
44-
"--web-socket-server-type",
45-
"sockjs",
33+
"--no-web-socket-server",
4634
]);
4735

4836
expect(exitCode).toEqual(0);

types/lib/Server.d.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,18 +1216,17 @@ declare class Server {
12161216
enum: boolean[];
12171217
cli: {
12181218
negatedDescription: string;
1219+
exclude?: undefined;
12191220
};
1220-
$ref?: undefined;
12211221
}
12221222
| {
1223-
$ref: string;
1224-
enum?: undefined;
1225-
cli?: undefined /** @typedef {import("express").Request} Request */;
1223+
enum: string[];
1224+
cli: {
1225+
exclude: boolean;
1226+
negatedDescription?: undefined;
1227+
};
12261228
}
12271229
)[];
1228-
cli: {
1229-
description: string;
1230-
};
12311230
};
12321231
WebSocketServerFunction: {
12331232
instanceof: string;
@@ -1253,6 +1252,9 @@ declare class Server {
12531252
WebSocketServerString: {
12541253
type: string;
12551254
minLength: number;
1255+
cli: {
1256+
exclude: boolean;
1257+
};
12561258
};
12571259
};
12581260
additionalProperties: boolean;

0 commit comments

Comments
 (0)