Skip to content

Commit e6950e2

Browse files
authored
refactor!: remove the --web-socket-server cli option (#4680)
1 parent 9b9272f commit e6950e2

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
@@ -2354,7 +2354,6 @@ class Server {
23542354
* @private
23552355
* @returns {void}
23562356
*/
2357-
// TODO: remove `--web-socket-server` in favor of `--web-socket-server-type`
23582357
createWebSocketServer() {
23592358
/** @type {WebSocketServerImplementation | undefined | null} */
23602359
this.webSocketServer = new /** @type {any} */ (this.getServerTransport())(

lib/options.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -887,12 +887,12 @@
887887
}
888888
},
889889
{
890-
"$ref": "#/definitions/WebSocketServerType"
890+
"enum": ["sockjs", "ws"],
891+
"cli": {
892+
"exclude": true
893+
}
891894
}
892-
],
893-
"cli": {
894-
"description": "Deprecated: please use '--web-socket-server-type' option."
895-
}
895+
]
896896
},
897897
"WebSocketServerFunction": {
898898
"instanceof": "Function"
@@ -925,7 +925,10 @@
925925
},
926926
"WebSocketServerString": {
927927
"type": "string",
928-
"minLength": 1
928+
"minLength": 1,
929+
"cli": {
930+
"exclude": true
931+
}
929932
}
930933
},
931934
"additionalProperties": false,

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

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

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
@@ -1264,18 +1264,17 @@ declare class Server {
12641264
enum: boolean[];
12651265
cli: {
12661266
negatedDescription: string;
1267+
exclude?: undefined;
12671268
};
1268-
$ref?: undefined;
12691269
}
12701270
| {
1271-
$ref: string;
1272-
enum?: undefined;
1273-
cli?: undefined /** @typedef {import("express").Request} Request */;
1271+
enum: string[];
1272+
cli: {
1273+
exclude: boolean;
1274+
negatedDescription?: undefined;
1275+
};
12741276
}
12751277
)[];
1276-
cli: {
1277-
description: string;
1278-
};
12791278
};
12801279
WebSocketServerFunction: {
12811280
instanceof: string;
@@ -1301,6 +1300,9 @@ declare class Server {
13011300
WebSocketServerString: {
13021301
type: string;
13031302
minLength: number;
1303+
cli: {
1304+
exclude: boolean;
1305+
};
13041306
};
13051307
};
13061308
additionalProperties: boolean;

0 commit comments

Comments
 (0)