Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @flow
import { Android, Config, ProjectSettings, UrlUtils } from 'xdl';
import chalk from 'chalk';
import indent from 'indent-string';
import path from 'path';
import pathExists from 'path-exists';
import qr from 'qrcode-terminal';
import log from '../util/log';
import packager from '../util/packager';
Config.validation.reactNativeVersionWarnings = false;
Config.developerTool = 'crna';
Config.offline = true;
packager.run(startAndroidAndPrintInfo);
// print a nicely formatted message with setup information
async function startAndroidAndPrintInfo() {
const address = await UrlUtils.constructManifestUrlAsync(process.cwd());
log.withTimestamp('Starting Android...');
const { success, error } = await Android.openProjectAsync(process.cwd());
qr.generate(address, qrCode => {
log.withTimestamp(`${chalk.green('Packager started!')}`);
log(
`
To view your app with live reloading, point the Expo app to this QR code.
You'll find the QR scanner on the Projects tab of the app.
return this.action(async (...args) => {
if (!skipUpdateCheck) {
try {
await checkForUpdateAsync();
} catch (e) {}
}
try {
let options = _.last(args);
if (options.output === 'raw') {
log.config.raw = true;
}
if (options.offline) {
Config.offline = true;
}
await asyncFn(...args);
// After a command, flush the analytics queue so the program will not have any active timers
// This allows node js to exit immediately
Analytics.flush();
} catch (err) {
// TODO: Find better ways to consolidate error messages
if (err._isCommandError) {
log.error(err.message);
} else if (err._isApiError) {
log.error(crayon.red(err.message));
} else if (err.isXDLError) {
log.error(err.message);
} else {
log.error(err.message);
// TODO: Is there a better way to do this? EXPO_DEBUG needs to be set to view the stack trace
return this.action(async (...args) => {
if (!skipUpdateCheck) {
try {
await checkForUpdateAsync();
} catch (e) {}
}
try {
let options = _.last(args);
if (options.output === 'raw') {
log.config.raw = true;
}
if (options.offline) {
Config.offline = true;
}
await asyncFn(...args);
// After a command, flush the analytics queue so the program will not have any active timers
// This allows node js to exit immediately
Analytics.flush();
} catch (err) {
// TODO: Find better ways to consolidate error messages
if (err._isCommandError) {
log.error(err.message);
} else if (err._isApiError) {
log.error(chalk.red(err.message));
} else if (err.isXDLError) {
log.error(err.message);
} else {
log.error(err.message);
import { Config, ProjectSettings, Simulator, UrlUtils } from 'xdl';
import chalk from 'chalk';
import indent from 'indent-string';
import path from 'path';
import pathExists from 'path-exists';
import qr from 'qrcode-terminal';
import log from '../util/log';
import { hasYarn } from '../util/pm';
import packager from '../util/packager';
Config.validation.reactNativeVersionWarnings = false;
Config.developerTool = 'crna';
Config.offline = true;
const command: string = hasYarn(process.cwd()) ? 'yarnpkg' : 'npm';
if (!Simulator.isPlatformSupported()) {
log(
chalk.red(
'\nThis command only works on macOS computers with Xcode and the iOS simulator installed.'
)
);
log(
chalk.yellow(
`If you run \`${chalk.cyan(command + ' start')}\` then you can view your app on a physical device.\n`
)
);
process.exit(1);
}
async function startExpoServer(projectRoot, packagerPort) {
Config.validation.reactNativeVersionWarnings = false;
Config.developerTool = 'crna';
Config.offline = true;
await Project.startExpoServerAsync(projectRoot);
await ProjectSettings.setPackagerInfoAsync(projectRoot, {
packagerPort
});
}
UserSettings,
Exp
} = require('xdl')
const chalk = require('chalk')
const indent = require('indent-string')
const qr = require('qrcode-terminal')
const readline = require('readline')
const clearConsole = require('./util/clearConsole')
const log = require('./util/log')
const packager = require('./util/packager')
Config.validation.reactNativeVersionWarnings = false
Config.developerTool = 'crna'
Config.offline = true
let dev = true
let projectDir
const options = {
interactive: true
}
const { stdin } = process
const startWaitingForCommand = () => {
stdin.setRawMode(true)
stdin.resume()
stdin.setEncoding('utf8')
stdin.on('data', handleKeypress)
}
import { Android, Config, Project, ProjectSettings, Simulator, UrlUtils, UserSettings } from 'xdl';
import chalk from 'chalk';
import indent from 'indent-string';
import qr from 'qrcode-terminal';
import minimist from 'minimist';
import readline from 'readline';
import { Exp } from 'xdl';
import clearConsole from '../util/clearConsole';
import log from '../util/log';
import packager from '../util/packager';
Config.validation.reactNativeVersionWarnings = false;
Config.developerTool = 'crna';
Config.offline = true;
const args = minimist(process.argv.slice(2), {
boolean: ['reset-cache', 'interactive'],
default: { interactive: true },
});
let dev = true;
const options = {};
if (args['reset-cache']) {
options.reset = true;
log('Asking packager to reset its cache...');
}
const { stdin } = process;
const startWaitingForCommand = () => {
stdin.setRawMode(true);