3
3
*
4
4
* This source code is licensed under the MIT license found in the
5
5
* 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
7
7
*/
8
8
9
- const opn = require ( 'opn ' )
9
+ const open = require ( 'open ' )
10
10
const execa = require ( 'execa' )
11
11
const chalk = require ( 'chalk' )
12
12
const execSync = require ( 'child_process' ) . execSync
13
13
14
- // https://github.com/sindresorhus/opn #app
14
+ // https://github.com/sindresorhus/open #app
15
15
const OSX_CHROME = 'google chrome'
16
16
17
17
const Actions = Object . freeze ( {
@@ -23,7 +23,7 @@ const Actions = Object.freeze({
23
23
function getBrowserEnv ( ) {
24
24
// Attempt to honor this environment variable.
25
25
// 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.
27
27
const value = process . env . BROWSER
28
28
let action
29
29
if ( ! value ) {
@@ -85,26 +85,26 @@ function startBrowserProcess (browser, url) {
85
85
}
86
86
87
87
// 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),
89
89
// 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
91
91
if ( process . platform === 'darwin' && browser === 'open' ) {
92
92
browser = undefined
93
93
}
94
94
95
- // Fallback to opn
95
+ // Fallback to open
96
96
// (It will always open new tab)
97
97
try {
98
98
var options = { app : browser }
99
- opn ( url , options ) . catch ( ( ) => { } ) // Prevent `unhandledRejection` error.
99
+ open ( url , options ) . catch ( ( ) => { } ) // Prevent `unhandledRejection` error.
100
100
return true
101
101
} catch ( err ) {
102
102
return false
103
103
}
104
104
}
105
105
106
106
/**
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
108
108
* true if it opened a browser or ran a node.js script, otherwise false.
109
109
*/
110
110
exports . openBrowser = function ( url ) {
0 commit comments