UNPKG

react-native-theoplayer

Version:

A THEOplayer video component for react-native.

27 lines (25 loc) 897 B
"use strict"; import { withDangerousMod } from '@expo/config-plugins'; import fs from 'fs'; import path from 'path'; /** * Add a custom pod-line to Podfile. */ function addPodToPodfile(contents, podLine) { const lines = contents.split('\n'); const targetIndex = lines.findIndex(line => line.trim().startsWith("target '")) + 1; if (targetIndex > 0 && !lines.includes(podLine)) { lines.splice(targetIndex, 0, podLine); } return lines.join('\n'); } export const withCustomPod = (config, podLine) => { return withDangerousMod(config, ['ios', async config => { const podfilePath = path.join(config.modRequest.projectRoot, 'ios', 'Podfile'); const contents = fs.readFileSync(podfilePath, 'utf8'); const newContents = addPodToPodfile(contents, podLine); fs.writeFileSync(podfilePath, newContents); return config; }]); }; //# sourceMappingURL=withCustomPod.js.map