Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function cleanUpPackager(projectDir) {
const result = await Promise.race([
Project.stopAsync(projectDir),
new Promise((resolve, reject) => setTimeout(resolve, 1000, 'stopFailed')),
]);
if (result === 'stopFailed') {
// find RN packager pid, attempt to kill manually
try {
const { packagerPid } = await ProjectSettings.readPackagerInfoAsync(projectDir);
process.kill(packagerPid);
} catch (e) {
process.exit(1);
}
}
}
async function cleanUpPackager (projectDir) {
const result = await Promise.race([
Project.stopAsync(projectDir),
new Promise((resolve, reject) => setTimeout(resolve, 1000, 'stopFailed'))
])
if (result === 'stopFailed') {
// find RN packager pid, attempt to kill manually
try {
const { packagerPid } = await ProjectSettings.readPackagerInfoAsync(projectDir)
process.kill(packagerPid)
} catch (e) {
process.exit(1)
}
}
}
async function printServerInfo() {
const settings = await ProjectSettings.readPackagerInfoAsync(process.cwd());
// who knows why qrcode-terminal takes a callback instead of just returning a string
const address = await UrlUtils.constructManifestUrlAsync(process.cwd());
let emulatorHelp;
if (process.platform === 'darwin') {
emulatorHelp = `Press ${chalk.bold('a')} (Android) or ${chalk.bold('i')} (iOS) to start an emulator.`;
} else {
emulatorHelp = `Press ${chalk.bold('a')} to start an Android emulator.`;
}
qr.generate(address, qrCode => {
log(`
${indent(qrCode, 2)}
Your app is now running at URL: ${chalk.underline(chalk.cyan(address))}
${chalk.bold('View your app with live reloading:')}
async function printServerInfo () {
await ProjectSettings.readPackagerInfoAsync(projectDir)
// who knows why qrcode-terminal takes a callback instead of just returning a string
const address = await UrlUtils.constructManifestUrlAsync(projectDir)
let emulatorHelp
if (process.platform === 'darwin') {
emulatorHelp = `Press ${chalk.bold('a')} (Android) or ${chalk.bold('i')} (iOS) to start an emulator.`
} else {
emulatorHelp = `Press ${chalk.bold('a')} to start an Android emulator.`
}
qr.generate(address, qrCode => {
log(`
${indent(qrCode, 2)}
Your app is now running at URL: ${chalk.underline(chalk.cyan(address))}
${chalk.bold('View your app with live reloading:')}
${chalk.underline('Android device:')}
-> Point the Expo app to the QR code above.
(You'll find the QR scanner on the Projects tab of the app.)