Skip to content

Commit

Permalink
feat(reactnative): Make pod install step optional (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich authored Nov 17, 2023
1 parent 6fa3bde commit 225e676
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- feat(reactnative): Make `pod install` step optional (#501)

## 3.16.5

- feat(remix): Add Vite support (#495)
Expand Down
2 changes: 2 additions & 0 deletions src/apple/cocoapod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ export async function podInstall(dir = '.') {
await bash.execute(`cd ${dir} && pod repo update`);
await bash.execute(`cd ${dir} && pod install --silent`);
installSpinner.stop('Pods installed.');
Sentry.setTag('pods-installed', true);
} catch (e) {
installSpinner.stop('Failed to install pods.');
Sentry.setTag('pods-installed', false);
clack.log.error(
`${chalk.red(
'Encountered the following error during pods installation:',
Expand Down
25 changes: 23 additions & 2 deletions src/react-native/react-native-wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as path from 'path';
import * as process from 'process';
import {
CliSetupConfigContent,
abortIfCancelled,
addSentryCliConfig,
confirmContinueIfNoOrDirtyGitRepo,
confirmContinueIfPackageVersionNotSupported,
Expand Down Expand Up @@ -248,9 +249,8 @@ async function patchXcodeFiles(config: RNCliSetupConfigContent) {
gitignore: false,
});

if (platform() === 'darwin') {
if (platform() === 'darwin' && (await confirmPodInstall())) {
await traceStep('pod-install', () => podInstall('ios'));
Sentry.setTag('pods-installed', true);
}

const xcodeProjectPath = traceStep('find-xcode-project', () =>
Expand Down Expand Up @@ -374,3 +374,24 @@ async function patchAndroidFiles(config: RNCliSetupConfigContent) {
chalk.green(`Android ${chalk.cyan('app/build.gradle')} saved.`),
);
}

async function confirmPodInstall(): Promise<boolean> {
return traceStep('confirm-pod-install', async () => {
const continueWithPodInstall = await abortIfCancelled(
clack.select({
message: 'Do you want to run `pod install` now?',
options: [
{
value: true,
label: 'Yes',
hint: 'Recommended for smaller projects, this might take several minutes',
},
{ value: false, label: `No, I'll do it later` },
],
initialValue: true,
}),
);
Sentry.setTag('continue-with-pod-install', continueWithPodInstall);
return continueWithPodInstall;
});
}

0 comments on commit 225e676

Please sign in to comment.