Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return
case 'r':
case 'R': {
clearConsole()
const reset = key === 'R'
if (reset) {
log.withTimestamp('Asking packager to reset its cache...')
}
log.withTimestamp('Restarting packager...')
Project.startAsync(projectDir, { reset })
return
}
case 'd':
clearConsole()
dev = !dev
await ProjectSettings.setAsync(projectDir, { dev })
log(
`Packager now running in ${chalk.bold(dev ? 'development' : 'production')}${chalk.reset(` mode.`)}
Please close and reopen the project in the Expo app for the
change to take effect.`
)
printUsage()
}
}
_setProjectSettingAsync = async options => {
let projectSettings = await ProjectSettings.setAsync(this.state.projectRoot, options);
let computedUrl = await this._computeUrlAsync(this.state.projectRoot);
this.setState({
projectSettings,
computedUrl,
});
};
return;
case 'r':
case 'R': {
clearConsole();
const reset = key === 'R';
if (reset) {
log.withTimestamp('Asking packager to reset its cache...');
}
log.withTimestamp('Restarting packager...');
Project.startAsync(process.cwd(), { reset });
return;
}
case 'd':
clearConsole();
dev = !dev;
await ProjectSettings.setAsync(process.cwd(), { dev });
log(
`Packager now running in ${chalk.bold(dev ? 'development' : 'production')}${chalk.reset(` mode.`)}
Please close and reopen the project in the Expo app for the
change to take effect.`
);
printUsage();
return;
}
}
let { url, isUrlFallback } = await Project.getManifestUrlWithFallbackAsync(projectDir);
let { exp } = await ProjectUtils.readConfigJsonAsync(projectDir);
if (!exp.isDetached) {
urlOpts.printQRCode(url);
}
log('Your URL is: ' + chalk.underline(url));
if (!exp.isDetached) {
await printRunInstructionsAsync();
}
if (isUrlFallback) {
await ProjectSettings.setAsync(projectDir, { hostType: 'lan' });
log.warn(
'Switched to a LAN URL because the tunnel appears to be down. ' +
'Only devices in the same network can access the app. ' +
'Restart with `exp start --tunnel` to try reconnecting.'
);
}
const recipient = await sendTo.getRecipient(options.sendTo);
if (recipient) {
await sendTo.sendUrlAsync(url, recipient);
}
await urlOpts.handleMobileOptsAsync(projectDir, options);
log(chalk.green('Logs for your project will appear below. Press Ctrl+C to exit.'));
opts.hostType = 'lan';
} else if (options.localhost) {
opts.hostType = 'localhost';
} else {
opts.hostType = 'lan';
}
let rawArgs = options.parent.rawArgs;
if (hasBooleanArg(rawArgs, 'dev')) {
opts.dev = getBooleanArg(rawArgs, 'dev');
}
if (hasBooleanArg(rawArgs, 'minify')) {
opts.minify = getBooleanArg(rawArgs, 'minify');
}
await ProjectSettings.setAsync(projectDir, opts);
return opts;
}
_setProjectSettingAsync = async (options) => {
let projectSettings = await ProjectSettings.setAsync(this.state.projectRoot, options);
let computedUrl = await this._computeUrlAsync(this.state.projectRoot);
this.setState({
projectSettings,
computedUrl,
});
};