Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow negative descriptions #4216

Merged
merged 6 commits into from Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 26 additions & 22 deletions bin/cli-flags.js
Expand Up @@ -46,13 +46,13 @@ module.exports = {
multiple: false,
description:
"Allows to broadcasts dev server via ZeroConf networking on start.",
negatedDescription:
"Disallows to broadcasts dev server via ZeroConf networking on start.",
path: "bonjour",
},
],
description:
"Allows to broadcasts dev server via ZeroConf networking on start.",
negatedDescription:
"Disallows to broadcasts dev server via ZeroConf networking on start.",
simpleType: "boolean",
multiple: false,
},
Expand Down Expand Up @@ -93,13 +93,13 @@ module.exports = {
multiple: false,
description:
"Enables a full-screen overlay in the browser when there are compiler errors or warnings.",
negatedDescription:
"Disables a full-screen overlay in the browser when there are compiler errors or warnings.",
path: "client.overlay",
},
],
description:
"Enables a full-screen overlay in the browser when there are compiler errors or warnings.",
negatedDescription:
"Disables a full-screen overlay in the browser when there are compiler errors or warnings.",
simpleType: "boolean",
multiple: false,
},
Expand Down Expand Up @@ -140,12 +140,12 @@ module.exports = {
multiple: false,
description:
"Prints compilation progress in percentage in the browser.",
negatedDescription:
"Does not print compilation progress in percentage in the browser.",
path: "client.progress",
},
],
description: "Prints compilation progress in percentage in the browser.",
negatedDescription:
"Does not print compilation progress in percentage in the browser.",
simpleType: "boolean",
multiple: false,
},
Expand All @@ -156,19 +156,22 @@ module.exports = {
multiple: false,
description:
"Tells dev-server the number of times it should try to reconnect the client.",
negatedDescription:
"Tells dev-server to not to try to connect the client.",
path: "client.reconnect",
},
{
type: "number",
multiple: false,
description:
"Tells dev-server the number of times it should try to reconnect the client.",
negatedDescription:
"Tells dev-server to not to try to connect the client.",
path: "client.reconnect",
},
],
description:
"Tells dev-server the number of times it should try to reconnect the client.",
negatedDescription: "Tells dev-server to not to try to connect the client.",
simpleType: "string",
multiple: false,
},
Expand Down Expand Up @@ -321,11 +324,11 @@ module.exports = {
type: "boolean",
multiple: false,
description: "Enables gzip compression for everything served.",
negatedDescription: "Disables gzip compression for everything served.",
path: "compress",
},
],
description: "Enables gzip compression for everything served.",
negatedDescription: "Disables gzip compression for everything served.",
simpleType: "boolean",
multiple: false,
},
Expand Down Expand Up @@ -370,18 +373,19 @@ module.exports = {
type: "boolean",
multiple: false,
description: "Enables Hot Module Replacement.",
negatedDescription: "Disables Hot Module Replacement.",
path: "hot",
},
{
type: "enum",
values: ["only"],
multiple: false,
description: "Enables Hot Module Replacement.",
negatedDescription: "Disables Hot Module Replacement.",
path: "hot",
},
],
description: "Enables Hot Module Replacement.",
negatedDescription: "Disables Hot Module Replacement.",
simpleType: "string",
multiple: false,
},
Expand All @@ -392,12 +396,12 @@ module.exports = {
multiple: false,
description:
"Allows to serve over HTTP/2 using SPDY. Deprecated, use the `server` option.",
negatedDescription: "Does not serve over HTTP/2 using SPDY.",
path: "http2",
},
],
description:
"Allows to serve over HTTP/2 using SPDY. Deprecated, use the `server` option.",
negatedDescription: "Does not serve over HTTP/2 using SPDY.",
simpleType: "boolean",
multiple: false,
},
Expand All @@ -408,13 +412,13 @@ module.exports = {
multiple: false,
description:
"Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the `server` option.",
negatedDescription:
"Disallows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP).",
path: "https",
},
],
description:
"Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the `server` option.",
negatedDescription:
"Disallows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP).",
simpleType: "boolean",
multiple: false,
},
Expand Down Expand Up @@ -620,12 +624,12 @@ module.exports = {
multiple: false,
description:
"Request for an SSL certificate. Deprecated, use the `server.options.requestCert` option.",
negatedDescription: "Does not request for an SSL certificate.",
path: "https.requestCert",
},
],
description:
"Request for an SSL certificate. Deprecated, use the `server.options.requestCert` option.",
negatedDescription: "Does not request for an SSL certificate.",
simpleType: "boolean",
multiple: false,
},
Expand Down Expand Up @@ -656,13 +660,13 @@ module.exports = {
multiple: false,
description:
"Enables reload/refresh the page(s) when file changes are detected (enabled by default).",
negatedDescription:
"Disables reload/refresh the page(s) when file changes are detected (enabled by default).",
path: "liveReload",
},
],
description:
"Enables reload/refresh the page(s) when file changes are detected (enabled by default).",
negatedDescription:
"Disables reload/refresh the page(s) when file changes are detected (enabled by default)",
simpleType: "boolean",
multiple: false,
},
Expand All @@ -673,13 +677,13 @@ module.exports = {
multiple: false,
description:
"Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').",
negatedDescription:
"Disables magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').",
path: "magicHtml",
},
],
description:
"Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').",
negatedDescription:
"Disables magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').",
simpleType: "boolean",
multiple: false,
},
Expand All @@ -697,12 +701,12 @@ module.exports = {
multiple: false,
description:
"Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser).",
negatedDescription: "Does not open the default browser.",
path: "open",
},
],
description:
"Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser).",
negatedDescription: "Does not open the default browser.",
simpleType: "string",
multiple: true,
},
Expand Down Expand Up @@ -786,7 +790,6 @@ module.exports = {
},
],
description: "Opens specified page in browser.",
negatedDescription: "Does not open specified page in browser.",
simpleType: "string",
multiple: true,
},
Expand Down Expand Up @@ -1140,12 +1143,12 @@ module.exports = {
multiple: true,
description:
"Tells dev server to use serveIndex middleware when enabled.",
negatedDescription:
"Does not tell dev server to use serveIndex middleware.",
path: "static[].serveIndex",
},
],
description: "Tells dev server to use serveIndex middleware when enabled.",
negatedDescription:
"Does not tell dev server to use serveIndex middleware.",
simpleType: "boolean",
multiple: true,
},
Expand All @@ -1155,11 +1158,12 @@ module.exports = {
type: "boolean",
multiple: true,
description: "Watches for files in static content directory.",
negatedDescription:
"Does not watch for files in static content directory.",
path: "static[].watch",
},
],
description: "Watches for files in static content directory.",
negatedDescription: "Does not watch for files in static content directory.",
simpleType: "boolean",
multiple: true,
},
Expand Down
62 changes: 52 additions & 10 deletions lib/options.json
Expand Up @@ -37,7 +37,10 @@
}
],
"description": "Allows to broadcasts dev server via ZeroConf networking on start.",
"link": " https://webpack.js.org/configuration/dev-server/#devserverbonjour"
"link": " https://webpack.js.org/configuration/dev-server/#devserverbonjour",
"cli": {
"negatedDescription": "Disallows to broadcasts dev server via ZeroConf networking on start."
}
},
"Client": {
"description": "Allows to specify options for client script in the browser or disable client script.",
Expand Down Expand Up @@ -82,7 +85,10 @@
{
"description": "Enables a full-screen overlay in the browser when there are compiler errors or warnings.",
"link": "https://webpack.js.org/configuration/dev-server/#overlay",
"type": "boolean"
"type": "boolean",
"cli": {
"negatedDescription": "Disables a full-screen overlay in the browser when there are compiler errors or warnings."
}
},
{
"type": "object",
Expand All @@ -103,7 +109,10 @@
"ClientProgress": {
"description": "Prints compilation progress in percentage in the browser.",
"link": "https://webpack.js.org/configuration/dev-server/#progress",
"type": "boolean"
"type": "boolean",
"cli": {
"negatedDescription": "Does not print compilation progress in percentage in the browser."
}
},
"ClientReconnect": {
"description": "Tells dev-server the number of times it should try to reconnect the client.",
Expand All @@ -116,7 +125,10 @@
"type": "number",
"minimum": 0
}
]
],
"cli": {
"negatedDescription": "Tells dev-server to not to try to connect the client."
}
},
"ClientWebSocketTransport": {
"anyOf": [
Expand Down Expand Up @@ -197,7 +209,10 @@
"Compress": {
"type": "boolean",
"description": "Enables gzip compression for everything served.",
"link": "https://webpack.js.org/configuration/dev-server/#devservercompress"
"link": "https://webpack.js.org/configuration/dev-server/#devservercompress",
"cli": {
"negatedDescription": "Disables gzip compression for everything served."
}
},
"DevMiddleware": {
"description": "Provide options to 'webpack-dev-middleware' which handles webpack assets.",
Expand All @@ -208,12 +223,18 @@
"HTTP2": {
"type": "boolean",
"description": "Allows to serve over HTTP/2 using SPDY. Deprecated, use the `server` option.",
"link": "https://webpack.js.org/configuration/dev-server/#devserverhttp2"
"link": "https://webpack.js.org/configuration/dev-server/#devserverhttp2",
"cli": {
"negatedDescription": "Does not serve over HTTP/2 using SPDY."
}
},
"HTTPS": {
"anyOf": [
{
"type": "boolean"
"type": "boolean",
"cli": {
"negatedDescription": "Disallows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP)."
}
},
{
"type": "object",
Expand All @@ -225,7 +246,10 @@
},
"requestCert": {
"type": "boolean",
"description": "Request for an SSL certificate. Deprecated, use the `server.options.requestCert` option."
"description": "Request for an SSL certificate. Deprecated, use the `server.options.requestCert` option.",
"cli": {
"negatedDescription": "Does not request for an SSL certificate."
}
},
"ca": {
"anyOf": [
Expand Down Expand Up @@ -458,7 +482,10 @@
}
],
"description": "Enables Hot Module Replacement.",
"link": "https://webpack.js.org/configuration/dev-server/#devserverhot"
"link": "https://webpack.js.org/configuration/dev-server/#devserverhot",
"cli": {
"negatedDescription": "Disables Hot Module Replacement."
}
},
"IPC": {
"anyOf": [
Expand All @@ -477,11 +504,17 @@
"LiveReload": {
"type": "boolean",
"description": "Enables reload/refresh the page(s) when file changes are detected (enabled by default).",
"cli": {
"negatedDescription": "Disables reload/refresh the page(s) when file changes are detected (enabled by default)."
},
"link": "https://webpack.js.org/configuration/dev-server/#devserverlivereload"
},
"MagicHTML": {
"type": "boolean",
"description": "Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').",
"cli": {
"negatedDescription": "Disables magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js')."
},
"link": "https://webpack.js.org/configuration/dev-server/#devservermagichtml"
},
"OnAfterSetupMiddleware": {
Expand Down Expand Up @@ -528,7 +561,10 @@
"link": "https://webpack.js.org/configuration/dev-server/#devserveropen"
},
"OpenBoolean": {
"type": "boolean"
"type": "boolean",
"cli": {
"negatedDescription": "Does not open the default browser."
}
},
"OpenObject": {
"type": "object",
Expand Down Expand Up @@ -934,6 +970,9 @@
}
],
"description": "Tells dev server to use serveIndex middleware when enabled.",
"cli": {
"negatedDescription": "Does not tell dev server to use serveIndex middleware."
},
"link": "https://webpack.js.org/configuration/dev-server/#serveindex"
},
"watch": {
Expand All @@ -948,6 +987,9 @@
}
],
"description": "Watches for files in static content directory.",
"cli": {
"negatedDescription": "Does not watch for files in static content directory."
},
"link": "https://webpack.js.org/configuration/dev-server/#watch"
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/cli/__snapshots__/basic.test.js.snap.webpack4
Expand Up @@ -106,7 +106,7 @@ Options:
--no-https-request-cert Does not request for an SSL certificate.
--ipc [value] Listen to a unix socket.
--live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default).
--no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default)
--no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default).
--magic-html Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').
--no-magic-html Disables magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').
--open [value...] Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser).
Expand Down