mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-26 05:15:49 +08:00
Prettier RN local-cli
Reviewed By: yungsters Differential Revision: D7962462 fbshipit-source-id: 0afe2092af8703895de91a6d1400315c3173aa6d
This commit is contained in:
committed by
Facebook Github Bot
parent
680fb50040
commit
aba4ec0c09
@@ -4,8 +4,10 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
|
||||
@@ -14,11 +16,16 @@
|
||||
const opn = require('opn');
|
||||
const execSync = require('child_process').execSync;
|
||||
|
||||
function commandExistsUnixSync (commandName, callback) {
|
||||
function commandExistsUnixSync(commandName, callback) {
|
||||
try {
|
||||
var stdout = execSync('command -v ' + commandName +
|
||||
' 2>/dev/null' +
|
||||
' && { echo >&1 \'' + commandName + ' found\'; exit 0; }');
|
||||
var stdout = execSync(
|
||||
'command -v ' +
|
||||
commandName +
|
||||
' 2>/dev/null' +
|
||||
" && { echo >&1 '" +
|
||||
commandName +
|
||||
" found'; exit 0; }",
|
||||
);
|
||||
return !!stdout;
|
||||
} catch (error) {
|
||||
return false;
|
||||
@@ -27,20 +34,20 @@ function commandExistsUnixSync (commandName, callback) {
|
||||
|
||||
function getChromeAppName(): string {
|
||||
switch (process.platform) {
|
||||
case 'darwin':
|
||||
return 'google chrome';
|
||||
case 'win32':
|
||||
return 'chrome';
|
||||
case 'linux':
|
||||
if (commandExistsUnixSync('google-chrome')) {
|
||||
case 'darwin':
|
||||
return 'google chrome';
|
||||
case 'win32':
|
||||
return 'chrome';
|
||||
case 'linux':
|
||||
if (commandExistsUnixSync('google-chrome')) {
|
||||
return 'google-chrome';
|
||||
} else if (commandExistsUnixSync('chromium-browser')) {
|
||||
return 'chromium-browser';
|
||||
} else {
|
||||
return 'chromium';
|
||||
}
|
||||
default:
|
||||
return 'google-chrome';
|
||||
} else if (commandExistsUnixSync('chromium-browser')) {
|
||||
return 'chromium-browser';
|
||||
} else {
|
||||
return 'chromium';
|
||||
}
|
||||
default:
|
||||
return 'google-chrome';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user