How to use the xdl.Project.startAsync function in xdl

To help you get started, weā€™ve selected a few xdl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NervJS / taro / packages / taro-rn-runner / src / util / packager.js View on Github external
// Subscribe to device updates separately from packager/server updates
  ProjectUtils.attachLoggerStream(projectDir, {
    stream: {
      write: chunk => {
        if (chunk.tag === 'device') {
          handleLogChunk(chunk)
        }
      }
    },
    type: 'raw'
  })

  installExitHooks(projectDir, isInteractive)
  log.withTimestamp('Starting packager...')

  Project.startAsync(projectDir, options).then(
    () => {},
    reason => {
      log.withTimestamp(chalk.red(`Error starting packager: ${reason.stack}`))
      process.exit(1)
    }
  )
}
github react-community / create-react-native-app / react-native-scripts / src / util / packager.js View on Github external
// Subscribe to device updates separately from packager/server updates
  ProjectUtils.attachLoggerStream(projectDir, {
    stream: {
      write: chunk => {
        if (chunk.tag === 'device') {
          handleLogChunk(chunk);
        }
      },
    },
    type: 'raw',
  });

  installExitHooks(projectDir, isInteractive);
  log.withTimestamp('Starting packager...');

  Project.startAsync(projectDir, options).then(
    () => {},
    reason => {
      log.withTimestamp(chalk.red(`Error starting packager: ${reason.stack}`));
      process.exit(1);
    }
  );
}
github expo / xde / src / ui / App.js View on Github external
}, async () => {
      // TODO: refactor this. can't call _startProjectAsync and _stopProjectAsync
      // because they rely on state.
      try {
        await Project.startAsync(this.state.projectRoot);
        this._logInfo('Project opened.');
      } catch (err) {
        this._logError(err.message);
      }

      let computedUrl = await this._computeUrlAsync();
      this.setState({
        computedUrl,
        isProjectRunning: true,
      });
    });
  };
github expo / xde / src / ui / MainScreen.js View on Github external
async () => {
        // TODO: refactor this. can't call _startProjectAsync and _stopProjectAsync
        // because they rely on setState calls that work asynchronously.
        let expJson;
        try {
          expJson = await Project.startAsync(this.state.projectRoot, { reset });
          this._logInfo(PROJECT_OPENED_MESSAGE);
        } catch (err) {
          this._logError(err.message);
        }

        let computedUrl = await this._computeUrlAsync(this.state.projectRoot);
        let expoSdkStatus = await Doctor.getExpoSdkStatus(this.state.projectRoot);
        this.setState({
          computedUrl,
          isProjectRunning: true,
          expJson,
          expoSdkStatus,
          isLoading: false,
        });
      }
    );
github react-community / create-react-native-app / react-native-scripts / src / scripts / start.js View on Github external
});
      return;
    }
    case 'q':
      clearConsole();
      await printServerInfo();
      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;
  }
}
github expo / exp / src / commands / start.js View on Github external
);
  }

  installExitHooks(projectDir);

  await urlOpts.optsAsync(projectDir, options);

  log(chalk.gray('Using project at', projectDir));

  let root = path.resolve(projectDir);
  let startOpts = {};
  if (options.clear) {
    startOpts.reset = true;
  }

  await Project.startAsync(root, startOpts);

  log('Expo is ready.');

  let url = await UrlUtils.constructManifestUrlAsync(projectDir);

  let { exp } = await ProjectUtils.readConfigJsonAsync(projectDir);

  if (!exp.isDetached) {
    log('You can scan this QR code:\n');
    urlOpts.printQRCode(url);
  }

  log('Your URL is\n\n' + chalk.underline(url) + '\n');
  log.raw(url);

  const recipient = await sendTo.getRecipient(options.sendTo);
github expo / expo-cli / packages / expo-cli / src / commands / start.js View on Github external
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.`
      );
    }
  }

  const startOpts = await parseStartOptionsAsync(projectDir, options);

  await Project.startAsync(rootPath, startOpts);
  await Web.logURL(projectDir);

  const url = await UrlUtils.constructManifestUrlAsync(projectDir);

  const recipient = await sendTo.getRecipient(options.sendTo);
  if (recipient) {
    await sendTo.sendUrlAsync(url, recipient);
  }

  await urlOpts.handleMobileOptsAsync(projectDir, options);

  if (!nonInteractive && !exp.isDetached) {
    await TerminalUI.startAsync(projectDir, startOpts);
  } else if (!options.webOnly) {
    if (!exp.isDetached) {
      log.newLine();
github expo / xde / src / ui / App.js View on Github external
}, async () => {
      try {
        let expJson = await Project.startAsync(projectRoot);
        this._logInfo('Project opened.');

        let computedUrl = await this._computeUrlAsync(projectRoot);
        this.setState({
          computedUrl,
          isProjectRunning: true,
          expJson,
        });
      } catch (err) {
        this._logError(err.message);
      }
    });
github expo / xde / src / ui / MainScreen.js View on Github external
async () => {
        try {
          let expJson = await Project.startAsync(projectRoot);
          this._logInfo(PROJECT_OPENED_MESSAGE);

          let computedUrl = await this._computeUrlAsync(projectRoot);
          let expoSdkStatus = await Doctor.getExpoSdkStatus(projectRoot);
          this._getRecentProjects();
          this.setState({
            computedUrl,
            isProjectRunning: true,
            expJson,
            expoSdkStatus,
            isLoading: false,
          });
        } catch (err) {
          this._logError(err.message);
        }
      }
github expo / exp / src / exp_commands / start.js View on Github external
await urlOpts.optsAsync(projectDir, options);

  log(chalk.gray('Using project at', projectDir));

  let root = path.resolve(projectDir);
  let startOpts = {};
  if (options.clear) {
    startOpts.reset = true;
  }

  if (options.maxWorkers) {
    startOpts.maxWorkers = options.maxWorkers;
  }

  await Project.startAsync(root, startOpts);

  log('Expo is ready.');
  log.newLine();

  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();