Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function checkAdbPath() {
const adbPath = getAdbPath();
const adbPathExists = fs.existsSync(adbPath);
const adbCmdExists = checkCommandExists('adb');
const adbNotFoundError = `"adb" not found in $location$. APK installation $prediction$ fail. Make sure you installed the Android SDK correctly. Read more at ${chalk.underline.dim(
'https://facebook.github.io/react-native/docs/getting-started',
)}`;
if (!adbPathExists || !adbCmdExists) {
const notFoundLocation = `${
!adbCmdExists ? 'PATH environment variable' : adbPath
}`;
logger.warn(
adbNotFoundError
.replace('$location$', notFoundLocation)
.replace('$prediction$', 'might'),
);
} else if (!adbPathExists && !adbCmdExists) {
throw new CLIError(
adbNotFoundError
.replace('$location$', `PATH environment variable or ${adbPath}`)