How to use the @expo/xdl.ExponentTools.spawnAsyncThrowError function in @expo/xdl

To help you get started, we’ve selected a few @expo/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 expo / turtle / src / bin / setup / android / sdk.ts View on Github external
async function _configureSdk(androidSdkDir: string) {
  // prevents warnings about missing repo config
  const androidRepositoriesCfgPath = path.join(os.homedir(), '.android/repositories.cfg');
  await fs.ensureFile(androidRepositoriesCfgPath);
  await ExponentTools.spawnAsyncThrowError('./configureAndroidSdk.sh', [], {
    pipeToLogger: true,
    loggerFields: LOGGER_FIELDS,
    cwd: path.join(config.directories.rootDir, 'scripts/android'),
    env: {
      ...process.env,
      ANDROID_HOME: androidSdkDir,
      ANDROID_SDK: androidSdkDir,
    },
  });
}
github expo / turtle / src / bin / setup / ios.ts View on Github external
versionCheckFn: async () => {
      const MINIMAL_VERSION = '2.99.0';

      const { stdout } = await ExponentTools.spawnAsyncThrowError(
        'fastlane',
        ['--version'],
        { stdio: 'pipe', env: { ...process.env, FASTLANE_SKIP_UPDATE_CHECK: '1', LC_ALL: 'en_US.UTF-8' } },
      );
      const fastlaneVersion = parseFastlaneVersion(stdout);
      if (fastlaneVersion && !semver.satisfies(fastlaneVersion, `>= ${MINIMAL_VERSION}`)) {
        throw new Error(
          `Your fastlane is on version ${fastlaneVersion}. Please upgrade it to at least ${MINIMAL_VERSION}.`,
        );
      }
    },
  },
github expo / turtle / src / bin / setup / ios.ts View on Github external
testFn: async () => {
      const { status, stdout } = await ExponentTools.spawnAsyncThrowError(
        'xcodebuild',
        ['-version'],
        { stdio: 'pipe' },
      );
      if (stdout.match(/requires xcode/i)) {
        return false;
      }

      if (status !== 0) {
        return false;
      }

      try {
        await ExponentTools.spawnAsyncThrowError('ibtool', ['--version'], { stdio: 'pipe' });
      } catch (err) {
        if (err.stderr) {
          const stderr = err.stderr.trim();
          if (stderr.match(/Agreeing to the Xcode\/iOS license/)) {
            logger.error('You have not accepted the Xcode license. Run \'sudo xcodebuild -runFirstLaunch\' to do so.');
            return false;
          }
          if (stderr.match(/The bundle is damaged or missing necessary resources/)) {
            logger.error(
              'Make sure to install additional required components. Run \'sudo xcodebuild -runFirstLaunch\' to do so.',
            );
            return false;
          }
        }
      }
github expo / turtle / src / bin / setup / ios.ts View on Github external
testFn: async () => {
      const { status, stdout } = await ExponentTools.spawnAsyncThrowError(
        'xcodebuild',
        ['-version'],
        { stdio: 'pipe' },
      );
      if (stdout.match(/requires xcode/i)) {
        return false;
      }

      if (status !== 0) {
        return false;
      }

      try {
        await ExponentTools.spawnAsyncThrowError('ibtool', ['--version'], { stdio: 'pipe' });
      } catch (err) {
        if (err.stderr) {
github expo / turtle / src / bin / setup / android / index.ts View on Github external
async function _installNodeModules(cwd: string) {
  l.info(`installing dependencies in ${cwd} directory...`);
  const command = await _shouldUseYarnOrNpm();
  await ExponentTools.spawnAsyncThrowError(command, ['install'], {
    pipeToLogger: true,
    loggerFields: LOGGER_FIELDS,
    cwd,
  });
  l.info('dependencies installed!');
}
github expo / turtle / src / bin / setup / android / index.ts View on Github external
testFn: async () => {
      const { status, stdout, stderr } = await ExponentTools.spawnAsyncThrowError(
        'java',
        ['-version'],
        { stdio: 'pipe' },
      );
      if (stdout.match(/no java runtime present/i)) {
        return false;
      }

      const matchResult = stderr.match(/.*version ".*\.(.*)\..*"/);
      if (matchResult) {
        const [, currentJavaVersion] = matchResult;
        if (Number(currentJavaVersion) !== JAVA_REQUIRED_VERSION) {
          throw new Error(`You're using a wrong Java version, please install version ${JAVA_REQUIRED_VERSION}`);
        }
      } else {
        logger.warn(`Couldn't find Java version number, assuming you're on Java ${JAVA_REQUIRED_VERSION}...`);