@react-native-community/cli-platform-android
Advanced tools
Comparing version 2.7.0 to 2.8.1
@@ -28,12 +28,2 @@ "use strict"; | ||
function _child_process() { | ||
const data = require("child_process"); | ||
_child_process = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _chalk() { | ||
@@ -83,10 +73,6 @@ const data = _interopRequireDefault(require("chalk")); | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
*/ | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
// Verifies this is an Android project | ||
@@ -134,3 +120,7 @@ function checkAndroid(root) { | ||
startServerInNewWindow(args.port, args.terminal, config.reactNativePath); | ||
try { | ||
startServerInNewWindow(args.port, args.terminal, config.reactNativePath); | ||
} catch (error) { | ||
_cliTools().logger.warn(`Failed to automatically start the packager server. Please run "react-native start" manually. Error details: ${error.message}`); | ||
} | ||
} | ||
@@ -204,3 +194,3 @@ | ||
(0, _child_process().execFileSync)(gradlew, gradleArgs, { | ||
_execa().default.sync(gradlew, gradleArgs, { | ||
stdio: 'inherit' | ||
@@ -229,3 +219,3 @@ }); | ||
(0, _child_process().execFileSync)(adbPath, adbArgs, { | ||
_execa().default.sync(adbPath, adbArgs, { | ||
stdio: 'inherit' | ||
@@ -320,24 +310,22 @@ }); | ||
if (process.platform === 'darwin') { | ||
if (terminal) { | ||
return (0, _child_process().spawnSync)('open', ['-a', terminal, launchPackagerScript], procConfig); | ||
try { | ||
return _execa().default.sync('open', ['-a', terminal, launchPackagerScript], procConfig); | ||
} catch (error) { | ||
return _execa().default.sync('open', [launchPackagerScript], procConfig); | ||
} | ||
return (0, _child_process().spawnSync)('open', [launchPackagerScript], procConfig); | ||
} | ||
if (process.platform === 'linux') { | ||
if (terminal) { | ||
procConfig.detached = true; | ||
return (0, _child_process().spawn)(terminal, ['-e', `sh ${launchPackagerScript}`], procConfig); | ||
} // By default, the child shell process will be attached to the parent | ||
procConfig.detached = false; | ||
return (0, _child_process().spawn)('sh', [launchPackagerScript], procConfig); | ||
try { | ||
return _execa().default.sync(terminal, ['-e', `sh ${launchPackagerScript}`], _objectSpread({}, procConfig, { | ||
detached: true | ||
})); | ||
} catch (error) { | ||
// By default, the child shell process will be attached to the parent | ||
return _execa().default.sync('sh', [launchPackagerScript], procConfig); | ||
} | ||
} | ||
if (/^win/.test(process.platform)) { | ||
procConfig.detached = true; | ||
procConfig.stdio = 'ignore'; //Temporary fix for #484. See comment on line 254 | ||
//Temporary fix for #484. See comment on line 254 | ||
_fs().default.writeFileSync(launchPackagerScript, launchPackagerScriptContent, { | ||
@@ -348,3 +336,6 @@ encoding: 'utf8', | ||
return (0, _child_process().spawn)('cmd.exe', ['/C', launchPackagerScript], procConfig); | ||
return _execa().default.sync('cmd.exe', ['/C', launchPackagerScript], _objectSpread({}, procConfig, { | ||
detached: true, | ||
stdio: 'ignore' | ||
})); | ||
} | ||
@@ -396,3 +387,3 @@ | ||
description: 'Launches the Metro Bundler in a new window using the specified terminal path.', | ||
default: _cliTools().getDefaultUserTerminal | ||
default: (0, _cliTools().getDefaultUserTerminal)() | ||
}, { | ||
@@ -399,0 +390,0 @@ name: '--tasks [list]', |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.default = getPackageClassName; | ||
exports.matchClassName = matchClassName; | ||
@@ -61,4 +62,14 @@ function _fs() { | ||
const packages = files.map(filePath => _fs().default.readFileSync(_path().default.join(folder, filePath), 'utf8')).map(file => file.match(/class\s+(.+[^\s])(\s+implements\s+|\s*:)[\s,\w]*[^{]*ReactPackage/)).filter(match => match); | ||
const packages = files.map(filePath => _fs().default.readFileSync(_path().default.join(folder, filePath), 'utf8')).map(matchClassName).filter(match => match); | ||
return packages.length ? packages[0][1] : null; | ||
} | ||
/** | ||
* Match function that is looking for package's class name in file | ||
* | ||
* @param {String} file Content of file to match | ||
*/ | ||
function matchClassName(file) { | ||
return file.match(/class\s+(\w+[^(\s]*)[\s\w():]*(\s+implements\s+|:)[\s\w():,]*[^{]*ReactPackage/); | ||
} |
{ | ||
"name": "@react-native-community/cli-platform-android", | ||
"version": "2.7.0", | ||
"version": "2.8.1", | ||
"license": "MIT", | ||
@@ -19,3 +19,3 @@ "main": "build/index.js", | ||
], | ||
"gitHead": "f89819e133340709109bdc144e69005ea4a6f944" | ||
"gitHead": "2ca00abb3441e7fab7ed00e81bdc843c748e92df" | ||
} |
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
61638
1456
4