diff --git a/docs/generated/packages/react-native/executors/pod-install.json b/docs/generated/packages/react-native/executors/pod-install.json index 2e4f9beae6847..e3d37e01a47ea 100644 --- a/docs/generated/packages/react-native/executors/pod-install.json +++ b/docs/generated/packages/react-native/executors/pod-install.json @@ -25,6 +25,11 @@ "description": "Disallow any changes to the Podfile or the Podfile.lock during installation.", "type": "boolean", "default": false + }, + "useBundler": { + "description": "Run cocoapods within a Bundler environment, i.e. with the `bundle exec pod install` command", + "type": "boolean", + "default": false } }, "required": ["buildFolder"], diff --git a/packages/react-native/src/executors/pod-install/schema.d.ts b/packages/react-native/src/executors/pod-install/schema.d.ts index 41f36baf08d81..d79cdb316f3a4 100644 --- a/packages/react-native/src/executors/pod-install/schema.d.ts +++ b/packages/react-native/src/executors/pod-install/schema.d.ts @@ -2,4 +2,5 @@ export interface ReactNativePodInstallOptions { buildFolder: string; // default is './build' repoUpdate: boolean; // default is false deployment: boolean; // default is false + useBundler: boolean; // default is false } diff --git a/packages/react-native/src/executors/pod-install/schema.json b/packages/react-native/src/executors/pod-install/schema.json index e6e373c4c756f..4cd0f4628fe59 100644 --- a/packages/react-native/src/executors/pod-install/schema.json +++ b/packages/react-native/src/executors/pod-install/schema.json @@ -22,6 +22,11 @@ "description": "Disallow any changes to the Podfile or the Podfile.lock during installation.", "type": "boolean", "default": false + }, + "useBundler": { + "description": "Run cocoapods within a Bundler environment, i.e. with the `bundle exec pod install` command", + "type": "boolean", + "default": false } }, "required": ["buildFolder"] diff --git a/packages/react-native/src/utils/pod-install-task.ts b/packages/react-native/src/utils/pod-install-task.ts index 780127f3e9bf7..48dc2f39b46b2 100644 --- a/packages/react-native/src/utils/pod-install-task.ts +++ b/packages/react-native/src/utils/pod-install-task.ts @@ -28,10 +28,12 @@ export function runPodInstall( buildFolder?: string; repoUpdate?: boolean; deployment?: boolean; + useBundler?: boolean; } = { buildFolder: './build', repoUpdate: false, deployment: false, + useBundler: false, } ): GeneratorCallback { return () => { @@ -57,10 +59,12 @@ export function podInstall( buildFolder?: string; repoUpdate?: boolean; deployment?: boolean; + useBundler?: boolean; } = { buildFolder: './build', repoUpdate: false, deployment: false, + useBundler: false, } ) { try { @@ -70,15 +74,15 @@ export function podInstall( stdio: 'inherit', }); } - execSync( - `pod install ${options.repoUpdate ? '--repo-update' : ''} ${ - options.deployment ? '--deployment' : '' - }`, - { - cwd: iosDirectory, - stdio: 'inherit', - } - ); + const podCommand = [ + options.useBundler ? 'bundle exec pod install' : 'pod install', + options.repoUpdate ? '--repo-update' : '', + options.deployment ? '--deployment' : '', + ].join(' '); + execSync(podCommand, { + cwd: iosDirectory, + stdio: 'inherit', + }); } catch (e) { logger.error(podInstallErrorMessage); throw e;