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 ' )
1010const execa = require ( 'execa' )
1111const chalk = require ( 'chalk' )
1212const execSync = require ( 'child_process' ) . execSync
1313
14- // https://github.com/sindresorhus/opn #app
14+ // https://github.com/sindresorhus/open #app
1515const OSX_CHROME = 'google chrome'
1616
1717const Actions = Object . freeze ( {
@@ -23,7 +23,7 @@ const Actions = Object.freeze({
2323function 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 */
110110exports . openBrowser = function ( url ) {
0 commit comments