How to use the @expo/config.findConfigFile 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 / expo-cli / src / commands / eject / Eject.ts View on Github external
async function getAppNamesAsync(
  projectRoot: string
): Promise<{ displayName: string; name: string }> {
  const { configPath, configName } = ConfigUtils.findConfigFile(projectRoot);
  const { exp, pkg } = await ConfigUtils.readConfigJsonAsync(projectRoot);

  const configBuffer = await fse.readFile(configPath);
  const appJson = configName === 'app.json' ? JSON.parse(configBuffer.toString()) : {};

  let { displayName, name } = appJson;
  if (!displayName || !name) {
    log("We have a couple of questions to ask you about how you'd like to name your app:");
    ({ displayName, name } = await prompt(
      [
        {
          name: 'displayName',
          message: "What should your app appear as on a user's home screen?",
          default: name || exp.name,
          validate({ length }: string): true | ValidationErrorMessage {
            return length ? true : 'App display name cannot be empty.';
github expo / expo-cli / packages / expo-cli / src / commands / push-creds.ts View on Github external
`If you wish to undo the current action, you can use the following command to upload your old credentials back to Expo's servers:`
      )
    );
    log(
      chalk.yellowBright(
        `expo push:web:upload --vapid-pubkey ${results.oldVapidData.vapidPublicKey} --vapid-pvtkey ${results.oldVapidData.vapidPrivateKey} --vapid-subject ${results.oldVapidData.vapidSubject}`
      )
    );
  }
  log(chalk.green(`VAPID data uploaded!`));

  /**
   * Customize app.json
   */
  log(`Reading app.json...`);
  const { configPath } = ConfigUtils.findConfigFile(projectDir);
  const appJson = JSON.parse(await fse.readFile(configPath).then(value => value.toString()));
  let changedProperties = [];

  if (user) {
    if (appJson.expo.owner && appJson.expo.owner !== user.username) {
      log(
        chalk.yellow(
          `Warning: expo.owner is already configured to be "${appJson.expo.owner}" in app.json, but your current username is "${user.username}". You will not receive any push notification if you do not change expo.owner to "${user.username}" in app.json. Alternatively, you could choose to login to "${appJson.expo.owner}" and then execute this command again.`
        )
      );
    } else {
      appJson.expo.owner = user.username;
      changedProperties.push('expo.owner');
    }
  }