UNPKG

react-native-theoplayer

Version:

A THEOplayer video component for react-native.

32 lines (31 loc) 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withCustomPod = void 0; var _configPlugins = require("@expo/config-plugins"); var _fs = _interopRequireDefault(require("fs")); var _path = _interopRequireDefault(require("path")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } /** * 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'); } const withCustomPod = (config, podLine) => { return (0, _configPlugins.withDangerousMod)(config, ['ios', async config => { const podfilePath = _path.default.join(config.modRequest.projectRoot, 'ios', 'Podfile'); const contents = _fs.default.readFileSync(podfilePath, 'utf8'); const newContents = addPodToPodfile(contents, podLine); _fs.default.writeFileSync(podfilePath, newContents); return config; }]); }; exports.withCustomPod = withCustomPod; //# sourceMappingURL=withCustomPod.js.map