How to use the @expo/config.fileExistsAsync function in @expo/config

To help you get started, we’ve selected a few @expo/config 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 / expo-cli / packages / xdl / src / project / Doctor.ts View on Github external
}

  try {
    await _checkWatchmanVersionAsync(projectRoot);
  } catch (e) {
    ProjectUtils.logWarning(
      projectRoot,
      'expo',
      `Warning: Problem checking watchman version. ${e.message}.`,
      'doctor-problem-checking-watchman-version'
    );
  }
  ProjectUtils.clearNotification(projectRoot, 'doctor-problem-checking-watchman-version');

  const expJsonExists = await fileExistsAsync(path.join(projectRoot, 'exp.json'));
  const appJsonExists = await fileExistsAsync(path.join(projectRoot, 'app.json'));

  if (expJsonExists && appJsonExists) {
    ProjectUtils.logWarning(
      projectRoot,
      'expo',
      `Warning: Both app.json and exp.json exist in this directory. Only one should exist for a single project.`,
      'doctor-both-app-and-exp-json'
    );
    return WARNING;
  }
  ProjectUtils.clearNotification(projectRoot, 'doctor-both-app-and-exp-json');

  let sdkVersion = exp.sdkVersion;
  const configName = configFilename(projectRoot);

  // Warn if sdkVersion is UNVERSIONED
github expo / expo-cli / packages / expo-cli / src / commands / client / index.js View on Github external
.asyncActionProjectDir(async (projectDir, options) => {
      const disabledServices = {
        pushNotifications: {
          name: 'Push Notifications',
          reason:
            'not yet available until API tokens are supported for the Push Notification system',
        },
      };

      // get custom project manifest if it exists
      // Note: this is the current developer's project, NOT the Expo client's manifest
      const spinner = ora(`Finding custom configuration for the Expo client...`).start();
      const appJsonPath = options.config || path.join(projectDir, 'app.json');
      const appJsonExists = await ConfigUtils.fileExistsAsync(appJsonPath);
      const { exp } = appJsonExists ? await ConfigUtils.readConfigJsonAsync(projectDir) : {};

      if (exp) {
        spinner.succeed(`Found custom configuration for the Expo client at ${appJsonPath}`);
      } else {
        spinner.warn(`Unable to find custom configuration for the Expo client`);
      }
      if (!_.has(exp, 'ios.config.googleMapsApiKey')) {
        const disabledReason = exp
          ? `ios.config.googleMapsApiKey does not exist in configuration file found in ${appJsonPath}`
          : 'No custom configuration file could be found. You will need to provide a json file with a valid ios.config.googleMapsApiKey field.';
        disabledServices.googleMaps = { name: 'Google Maps', reason: disabledReason };
      }
      if (_.has(exp, 'ios.googleServicesFile')) {
        const contents = await fs.readFile(
          path.resolve(projectDir, exp.ios.googleServicesFile),
github expo / expo-cli / packages / xdl / src / project / Doctor.ts View on Github external
return FATAL;
  }

  try {
    await _checkWatchmanVersionAsync(projectRoot);
  } catch (e) {
    ProjectUtils.logWarning(
      projectRoot,
      'expo',
      `Warning: Problem checking watchman version. ${e.message}.`,
      'doctor-problem-checking-watchman-version'
    );
  }
  ProjectUtils.clearNotification(projectRoot, 'doctor-problem-checking-watchman-version');

  const expJsonExists = await fileExistsAsync(path.join(projectRoot, 'exp.json'));
  const appJsonExists = await fileExistsAsync(path.join(projectRoot, 'app.json'));

  if (expJsonExists && appJsonExists) {
    ProjectUtils.logWarning(
      projectRoot,
      'expo',
      `Warning: Both app.json and exp.json exist in this directory. Only one should exist for a single project.`,
      'doctor-both-app-and-exp-json'
    );
    return WARNING;
  }
  ProjectUtils.clearNotification(projectRoot, 'doctor-both-app-and-exp-json');

  let sdkVersion = exp.sdkVersion;
  const configName = configFilename(projectRoot);