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 action(projectDir, options) {
installExitHooks(projectDir);
await urlOpts.optsAsync(projectDir, options);
log(chalk.gray('Starting project at', projectDir));
let rootPath = path.resolve(projectDir);
let devToolsUrl = await DevToolsServer.startAsync(rootPath);
log(`Expo DevTools is running at ${chalk.underline(devToolsUrl)}`);
const { exp } = await ProjectUtils.readConfigJsonAsync(projectDir);
if (exp === null) {
log.warn('No Expo configuration found. Are you sure this is a project directory?');
process.exit(1);
}
const nonInteractive = options.parent && options.parent.nonInteractive;
if (!nonInteractive && !exp.isDetached) {
if (await UserSettings.getAsync('openDevToolsAtStartup', true)) {
log(`Opening DevTools in the browser... (press ${chalk.bold`shift-d`} to disable)`);
opn(devToolsUrl, { wait: false });
} else {
log(
`Press ${chalk.bold`d`} to open DevTools now, or ${chalk.bold`shift-d`} to always open it automatically.`
async function tryOpeningDevToolsAsync({ rootPath, exp, options }): Promise {
const devToolsUrl = await DevToolsServer.startAsync(rootPath);
log(`Expo DevTools is running at ${chalk.underline(devToolsUrl)}`);
if (!options.nonInteractive && !exp.isDetached) {
if (await UserSettings.getAsync('openDevToolsAtStartup', true)) {
log(`Opening DevTools in the browser... (press ${chalk.bold`shift-d`} to disable)`);
openBrowser(devToolsUrl);
} else {
log(
`Press ${chalk.bold`d`} to open DevTools now, or ${chalk.bold`shift-d`} to always open it automatically.`
);
}
}
}