Skip to content

Commit 78bc1db

Browse files
committed
chore(openBrowser): sync with upstream
(cherry picked from commit f078c46)
1 parent 6f085d3 commit 78bc1db

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

packages/@vue/cli-shared-utils/lib/openBrowser.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file at
6-
* https://github.com/facebookincubator/create-react-app/blob/master/LICENSE
6+
* https://github.com/facebook/create-react-app/blob/master/LICENSE
77
*/
88

9-
const opn = require('opn')
9+
const open = require('open')
1010
const execa = require('execa')
1111
const chalk = require('chalk')
1212
const execSync = require('child_process').execSync
1313

14-
// https://github.com/sindresorhus/opn#app
14+
// https://github.com/sindresorhus/open#app
1515
const OSX_CHROME = 'google chrome'
1616

1717
const Actions = Object.freeze({
@@ -23,7 +23,7 @@ const Actions = Object.freeze({
2323
function getBrowserEnv () {
2424
// Attempt to honor this environment variable.
2525
// It is specific to the operating system.
26-
// See https://github.com/sindresorhus/opn#app for documentation.
26+
// See https://github.com/sindresorhus/open#app for documentation.
2727
const value = process.env.BROWSER
2828
let action
2929
if (!value) {
@@ -85,26 +85,26 @@ function startBrowserProcess (browser, url) {
8585
}
8686

8787
// Another special case: on OS X, check if BROWSER has been set to "open".
88-
// In this case, instead of passing `open` to `opn` (which won't work),
88+
// In this case, instead of passing the string `open` to `open` function (which won't work),
8989
// just ignore it (thus ensuring the intended behavior, i.e. opening the system browser):
90-
// https://github.com/facebookincubator/create-react-app/pull/1690#issuecomment-283518768
90+
// https://github.com/facebook/create-react-app/pull/1690#issuecomment-283518768
9191
if (process.platform === 'darwin' && browser === 'open') {
9292
browser = undefined
9393
}
9494

95-
// Fallback to opn
95+
// Fallback to open
9696
// (It will always open new tab)
9797
try {
9898
var options = { app: browser }
99-
opn(url, options).catch(() => {}) // Prevent `unhandledRejection` error.
99+
open(url, options).catch(() => {}) // Prevent `unhandledRejection` error.
100100
return true
101101
} catch (err) {
102102
return false
103103
}
104104
}
105105

106106
/**
107-
* Reads the BROWSER evironment variable and decides what to do with it. Returns
107+
* Reads the BROWSER environment variable and decides what to do with it. Returns
108108
* true if it opened a browser or ran a node.js script, otherwise false.
109109
*/
110110
exports.openBrowser = function (url) {

packages/@vue/cli-shared-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"launch-editor": "^2.2.1",
2727
"lru-cache": "^5.1.1",
2828
"node-ipc": "^9.1.1",
29-
"opn": "^5.3.0",
29+
"open": "^6.3.0",
3030
"ora": "^3.4.0",
3131
"request": "^2.87.0",
3232
"request-promise-native": "^1.0.7",

0 commit comments

Comments
 (0)