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

fix: Replaced opn (deprecated) with open #7058

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/react-dev-utils/openBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down