Skip to content

Commit

Permalink
feat(react-native): run pod commands with bundler (nrwl#19727)
Browse files Browse the repository at this point in the history
Signed-off-by: Stefano Formicola <[email protected]>
Co-authored-by: Stefano Formicola <[email protected]>
  • Loading branch information
ste7en and Stefano Formicola authored Oct 24, 2023
1 parent 2c850cf commit 1f903ed
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
5 changes: 5 additions & 0 deletions packages/react-native/src/executors/pod-install/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
22 changes: 13 additions & 9 deletions packages/react-native/src/utils/pod-install-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -57,10 +59,12 @@ export function podInstall(
buildFolder?: string;
repoUpdate?: boolean;
deployment?: boolean;
useBundler?: boolean;
} = {
buildFolder: './build',
repoUpdate: false,
deployment: false,
useBundler: false,
}
) {
try {
Expand All @@ -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;
Expand Down

0 comments on commit 1f903ed

Please sign in to comment.