UNPKG

react-native-nitro-screen-recorder

Version:

A library to capture screen recordings with react-native powered by NitroModules.

30 lines (29 loc) 1.3 kB
"use strict"; var __importDefault = this && this.__importDefault || function (mod) { return mod && mod.__esModule ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.updatePodfile = updatePodfile; // updatePodfile.ts const fs_1 = __importDefault(require("fs")); const iosConstants_1 = require("./iosConstants"); const ScreenRecorderLog_1 = require("./ScreenRecorderLog"); const FileManager_1 = require("./FileManager"); async function updatePodfile(iosPath) { const podfilePath = `${iosPath}/Podfile`; let podfile = await FileManager_1.FileManager.readFile(podfilePath); // Skip if already present if (podfile.includes(iosConstants_1.BROADCAST_EXT_TARGET_NAME)) { ScreenRecorderLog_1.ScreenRecorderLog.log('Extension target already in Podfile. Skipping…'); return; } // Inject snippet into every `target 'Something' do … end` that looks like an iOS app podfile = podfile.replace(/target ['"][^'"]+['"] do([\s\S]*?)end/g, block => block.replace(/\nend$/, `${iosConstants_1.BROADCAST_EXT_PODFILE_SNIPPET}\nend`)); await fs_1.default.promises.writeFile(podfilePath, podfile, 'utf8'); ScreenRecorderLog_1.ScreenRecorderLog.log('Inserted BroadcastExtension into Podfile.'); } //# sourceMappingURL=updatePodfile.js.map