Skip to content

Commit 592ca21

Browse files
committed
feat: add --only-pods option to run/build-ios commands
1 parent 7647359 commit 592ca21

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

__e2e__/__snapshots__/config.test.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exports[`shows up current config without unnecessary output 1`] = `
44
{
55
"root": "<<REPLACED_ROOT>>/TestProject",
66
"reactNativePath": "<<REPLACED_ROOT>>/TestProject/node_modules/react-native",
7-
"reactNativeVersion": "0.77",
7+
"reactNativeVersion": "0.78",
88
"dependencies": {},
99
"commands": [
1010
{

packages/cli-platform-apple/src/commands/buildCommand/buildOptions.ts

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type BuildFlags = {
1212
destination?: string;
1313
extraParams?: string[];
1414
forcePods?: boolean;
15+
onlyPods?: boolean;
1516
};
1617

1718
export const getBuildOptions = ({platformName}: BuilderCommand) => {
@@ -62,6 +63,10 @@ export const getBuildOptions = ({platformName}: BuilderCommand) => {
6263
name: '--force-pods',
6364
description: 'Force CocoaPods installation',
6465
},
66+
{
67+
name: '--only-pods',
68+
description: 'Only install Cocoapods, do not build the app',
69+
},
6570
!isMac && {
6671
name: '--device [string]', // here we're intentionally using [] over <> to make passed value optional to allow users to run only on physical devices
6772
description:

packages/cli-platform-apple/src/commands/buildCommand/createBuild.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ const createBuild =
2424
}
2525

2626
let installedPods = false;
27-
if (platformConfig.automaticPodsInstallation || args.forcePods) {
27+
if (
28+
platformConfig.automaticPodsInstallation ||
29+
args.forcePods ||
30+
args.onlyPods
31+
) {
2832
const isAppRunningNewArchitecture = platformConfig.sourceDir
2933
? await getArchitecture(platformConfig.sourceDir)
3034
: undefined;
@@ -43,6 +47,10 @@ const createBuild =
4347
installedPods = true;
4448
}
4549

50+
if (args.onlyPods) {
51+
return;
52+
}
53+
4654
let {xcodeProject, sourceDir} = getXcodeProjectAndDir(
4755
platformConfig,
4856
platformName,

packages/cli-platform-apple/src/commands/runCommand/createRun.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ const createRun =
7979
let {packager, port} = args;
8080
let installedPods = false;
8181
// check if pods need to be installed
82-
if (platformConfig.automaticPodsInstallation || args.forcePods) {
82+
if (
83+
platformConfig.automaticPodsInstallation ||
84+
args.forcePods ||
85+
args.onlyPods
86+
) {
8387
const isAppRunningNewArchitecture = platformConfig.sourceDir
8488
? await getArchitecture(platformConfig.sourceDir)
8589
: undefined;
@@ -98,6 +102,10 @@ const createRun =
98102
installedPods = true;
99103
}
100104

105+
if (args.onlyPods) {
106+
return;
107+
}
108+
101109
if (packager) {
102110
const {port: newPort, startPackager} = await findDevServerPort(
103111
port,

packages/cli-platform-ios/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ List all available iOS devices and simulators and let you choose one to run the
118118

119119
Force running `pod install` before running an app
120120

121+
#### `--only-pods`,
122+
123+
Only install Cocoapods, do not build the app.
124+
121125
### `build-ios`
122126

123127
Usage:
@@ -177,6 +181,10 @@ npx react-native build-ios --extra-params "-jobs 4"
177181

178182
Force running `pod install` before building an app
179183

184+
#### `--only-pods`,
185+
186+
Only install Cocoapods, do not build the app.
187+
180188
### `log-ios`
181189

182190
Usage:

0 commit comments

Comments
 (0)