1const { withDangerousMod } = require('@expo/config-plugins');
2const assert = require('assert');
3const fs = require('fs-extra');
4const path = require('path');
5
6// Use this plugin to set the Podfile min version to 11.0 (required for GoogleSignIn).
7module.exports = (config, version) => {
8  assert(version, 'Podfile version must be defined. ex. "10.0"');
9  return withDangerousMod(config, [
10    'ios',
11    async (config) => {
12      const filePath = path.join(config.modRequest.projectRoot, 'ios', 'Podfile');
13      let contents = await fs.readFile(filePath, 'utf-8');
14      contents = contents.replace(/platform :ios, '(.*)'/, `platform :ios, '${version}'`);
15      await fs.writeFile(filePath, contents);
16
17      return config;
18    },
19  ]);
20};
21