@react-native-community/cli-tools
Advanced tools
Comparing version 4.11.0 to 4.13.0
@@ -8,36 +8,4 @@ "use strict"; | ||
function _open() { | ||
const data = _interopRequireDefault(require("open")); | ||
_open = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _child_process() { | ||
const data = require("child_process"); | ||
_child_process = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
var _logger = _interopRequireDefault(require("./logger")); | ||
var _launchDefaultBrowser = _interopRequireDefault(require("./launchDefaultBrowser")); | ||
function _chalk() { | ||
const data = _interopRequireDefault(require("chalk")); | ||
_chalk = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -53,64 +21,4 @@ | ||
*/ | ||
function commandExistsUnixSync(commandName) { | ||
try { | ||
const stdout = (0, _child_process().execSync)(`command -v ${commandName} 2>/dev/null` + ` && { echo >&1 '${commandName} found'; exit 0; }`); | ||
return !!stdout; | ||
} catch (error) { | ||
return false; | ||
} | ||
} | ||
function getChromeAppName() { | ||
switch (process.platform) { | ||
case 'darwin': | ||
return 'google chrome'; | ||
case 'win32': | ||
{ | ||
const possibleDebuggingApps = ['chrome.exe', 'msedge.exe']; | ||
const output = (0, _child_process().execSync)('tasklist /NH /FO CSV /FI "SESSIONNAME ne Services"').toString(); | ||
const runningProcesses = output.split('\n').map(line => line.replace(/^"|".*\r$/gm, '')); | ||
for (const app of possibleDebuggingApps) { | ||
if (runningProcesses.includes(app)) { | ||
return app; | ||
} | ||
} | ||
return 'chrome'; | ||
} | ||
case 'linux': | ||
if (commandExistsUnixSync('google-chrome')) { | ||
return 'google-chrome'; | ||
} | ||
if (commandExistsUnixSync('chromium-browser')) { | ||
return 'chromium-browser'; | ||
} | ||
return 'chromium'; | ||
default: | ||
return 'google-chrome'; | ||
} | ||
} | ||
function launchChrome(url) { | ||
return (0, _open().default)(url, { | ||
app: [getChromeAppName()], | ||
wait: true | ||
}); | ||
} | ||
async function launchDebugger(url) { | ||
try { | ||
await launchChrome(url); | ||
} catch (error) { | ||
_logger.default.debug(error); | ||
_logger.default.info(`For a better debugging experience please install Google Chrome from: ${_chalk().default.underline.dim('https://www.google.com/chrome/')}`); | ||
(0, _launchDefaultBrowser.default)(url); | ||
} | ||
return (0, _launchDefaultBrowser.default)(url); | ||
} | ||
@@ -117,0 +25,0 @@ |
{ | ||
"name": "@react-native-community/cli-tools", | ||
"version": "4.11.0", | ||
"version": "4.13.0", | ||
"license": "MIT", | ||
@@ -27,3 +27,3 @@ "main": "build/index.js", | ||
], | ||
"gitHead": "a94c0446ad2a1ab68c040dd51cd9eec6a0605993" | ||
"gitHead": "6cf12b00c02aca6d4bc843446394331d71a9749e" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
33794
739