UNPKG

@nx/expo

Version:

The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.

69 lines (66 loc) 2.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.runPodInstall = runPodInstall; exports.podInstall = podInstall; const child_process_1 = require("child_process"); const node_fs_1 = require("node:fs"); const os_1 = require("os"); const path_1 = require("path"); const pc = require("picocolors"); const devkit_1 = require("@nx/devkit"); const podInstallErrorMessage = ` Running ${pc.bold('pod install')} failed, see above. Do you have CocoaPods (https://cocoapods.org/) installed? Check that your XCode path is correct: ${pc.bold('sudo xcode-select --print-path')} If the path is wrong, switch the path: (your path may be different) ${pc.bold('sudo xcode-select --switch /Applications/Xcode.app')} `; /** * Run pod install on ios directory * @deprecated This should be removed as Expo runs this automatically on `run-ios` * @param iosDirectory ios directory that contains Podfile * @returns resolve with 0 if not error, reject with error otherwise */ function runPodInstall(iosDirectory, install = true, options = { buildFolder: './build', repoUpdate: false, deployment: false, }) { return () => { if ((0, os_1.platform)() !== 'darwin') { devkit_1.logger.info('Skipping `pod install` on non-darwin platform'); return; } if (!install || !(0, node_fs_1.existsSync)((0, path_1.join)(iosDirectory, 'Podfile'))) { devkit_1.logger.info('Skipping `pod install`'); return; } devkit_1.logger.info(`Running \`pod install\` from "${iosDirectory}"`); return podInstall(iosDirectory, options); }; } function podInstall(iosDirectory, options = { buildFolder: './build', repoUpdate: false, deployment: false, }) { try { if ((0, node_fs_1.existsSync)((0, path_1.join)(iosDirectory, '.xcode.env'))) { (0, child_process_1.execSync)('touch .xcode.env', { cwd: iosDirectory, stdio: 'inherit', windowsHide: false, }); } (0, child_process_1.execSync)(`pod install ${options.repoUpdate ? '--repo-update' : ''} ${options.deployment ? '--deployment' : ''}`, { cwd: iosDirectory, stdio: 'inherit', windowsHide: false, }); } catch (e) { devkit_1.logger.error(podInstallErrorMessage); throw e; } }