mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-29 01:45:40 +08:00
Replace opn with open (#7058)
The `opn` package has been deprecated, replaced by `open`.
This commit is contained in:
committed by
Brody McKee
parent
bdaccf7161
commit
a98337c257
10
packages/react-dev-utils/openBrowser.js
vendored
10
packages/react-dev-utils/openBrowser.js
vendored
@@ -10,9 +10,9 @@
|
||||
var chalk = require('chalk');
|
||||
var execSync = require('child_process').execSync;
|
||||
var spawn = require('cross-spawn');
|
||||
var opn = require('opn');
|
||||
var open = require('open');
|
||||
|
||||
// https://github.com/sindresorhus/opn#app
|
||||
// https://github.com/sindresorhus/open#app
|
||||
var OSX_CHROME = 'google chrome';
|
||||
|
||||
const Actions = Object.freeze({
|
||||
@@ -24,7 +24,7 @@ const Actions = Object.freeze({
|
||||
function getBrowserEnv() {
|
||||
// Attempt to honor this environment variable.
|
||||
// It is specific to the operating system.
|
||||
// See https://github.com/sindresorhus/opn#app for documentation.
|
||||
// See https://github.com/sindresorhus/open#app for documentation.
|
||||
const value = process.env.BROWSER;
|
||||
let action;
|
||||
if (!value) {
|
||||
@@ -93,11 +93,11 @@ function startBrowserProcess(browser, url) {
|
||||
browser = undefined;
|
||||
}
|
||||
|
||||
// Fallback to opn
|
||||
// Fallback to open
|
||||
// (It will always open new tab)
|
||||
try {
|
||||
var options = { app: browser, wait: false };
|
||||
opn(url, options).catch(() => {}); // Prevent `unhandledRejection` error.
|
||||
open(url, options).catch(() => {}); // Prevent `unhandledRejection` error.
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
"inquirer": "6.2.2",
|
||||
"is-root": "2.0.0",
|
||||
"loader-utils": "1.2.3",
|
||||
"opn": "5.4.0",
|
||||
"open": "^6.3.0",
|
||||
"pkg-up": "2.0.0",
|
||||
"react-error-overlay": "^5.1.6",
|
||||
"recursive-readdir": "2.2.2",
|
||||
|
||||
Reference in New Issue
Block a user