Skip to content

Commit

Permalink
fix: mark --open-app deprecated in favor of --open-app-name (#4091)
Browse files Browse the repository at this point in the history
* fix: mark `--open-app` deprecated in favor of `--open-app-name`

* docs: update

* fix: update description
  • Loading branch information
snitin315 authored Dec 10, 2021
1 parent 2e85dd1 commit 693c28a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Options:
--no-open Does not open the default browser.
--open-target <value...> Opens specified page in browser.
--open-app-name <value...> Open specified browser.
--open-app <value...> Open specified browser.
--open-app <value...> Open specified browser. Deprecated: please use '--open-app-name'.
--open-reset Clear all items provided in 'open' configuration. 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).
--open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser.
--open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser.
Expand Down
6 changes: 4 additions & 2 deletions bin/cli-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,11 +806,13 @@ module.exports = {
{
type: "string",
multiple: true,
description: "Open specified browser.",
description:
"Open specified browser. Deprecated: please use '--open-app-name'.",
path: "open[].app",
},
],
description: "Open specified browser.",
description:
"Open specified browser. Deprecated: please use '--open-app-name'.",
simpleType: "string",
multiple: true,
},
Expand Down
1 change: 1 addition & 0 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ class Server {

// https://github.com/webpack/webpack-dev-server/issues/1990
const defaultOpenOptions = { wait: false };
// TODO: remove --open-app in favor of --open-app-name
const getOpenItemsFromObject = ({ target, ...rest }) => {
const normalizedOptions = { ...defaultOpenOptions, ...rest };

Expand Down
3 changes: 2 additions & 1 deletion lib/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,8 @@
},
{
"type": "string",
"minLength": 1
"minLength": 1,
"description": "Open specified browser. Deprecated: please use '--open-app-name'."
}
],
"description": "Open specified browser."
Expand Down
3 changes: 2 additions & 1 deletion test/__snapshots__/validate-options.test.js.snap.webpack4
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ exports[`options validate should throw an error on the "open" option with '{"app
Details:
* options.open.app should be an object:
object { name?, arguments? }
* options.open.app should be a non-empty string."
* options.open.app should be a non-empty string.
-> Open specified browser. Deprecated: please use '--open-app-name'."
`;

exports[`options validate should throw an error on the "open" option with '{"foo":"bar"}' value 1`] = `
Expand Down
3 changes: 2 additions & 1 deletion test/__snapshots__/validate-options.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ exports[`options validate should throw an error on the "open" option with '{"app
Details:
* options.open.app should be an object:
object { name?, arguments? }
* options.open.app should be a non-empty string."
* options.open.app should be a non-empty string.
-> Open specified browser. Deprecated: please use '--open-app-name'."
`;

exports[`options validate should throw an error on the "open" option with '{"foo":"bar"}' value 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion test/cli/__snapshots__/basic.test.js.snap.webpack4
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Options:
--no-open Does not open the default browser.
--open-target <value...> Opens specified page in browser.
--open-app-name <value...> Open specified browser.
--open-app <value...> Open specified browser.
--open-app <value...> Open specified browser. Deprecated: please use '--open-app-name'.
--open-reset Clear all items provided in 'open' configuration. 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).
--open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser.
--open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser.
Expand Down
2 changes: 1 addition & 1 deletion test/cli/__snapshots__/basic.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Options:
--no-open Negative 'open' option.
--open-target <value...> Opens specified page in browser.
--open-app-name <value...> Open specified browser.
--open-app <value...> Open specified browser.
--open-app <value...> Open specified browser. Deprecated: please use '--open-app-name'.
--open-reset Clear all items provided in 'open' configuration. 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).
--open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser.
--open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser.
Expand Down

0 comments on commit 693c28a

Please sign in to comment.