Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add --only-pods option to run/build-ios commands #2624

Merged
merged 2 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __e2e__/__snapshots__/config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`shows up current config without unnecessary output 1`] = `
{
"root": "<<REPLACED_ROOT>>/TestProject",
"reactNativePath": "<<REPLACED_ROOT>>/TestProject/node_modules/react-native",
"reactNativeVersion": "0.77",
"reactNativeVersion": "0.78",
"dependencies": {},
"commands": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type BuildFlags = {
destination?: string;
extraParams?: string[];
forcePods?: boolean;
onlyPods?: boolean;
};

export const getBuildOptions = ({platformName}: BuilderCommand) => {
Expand Down Expand Up @@ -62,6 +63,10 @@ export const getBuildOptions = ({platformName}: BuilderCommand) => {
name: '--force-pods',
description: 'Force CocoaPods installation',
},
{
name: '--only-pods',
description: 'Only install Cocoapods, do not build the app',
},
!isMac && {
name: '--device [string]', // here we're intentionally using [] over <> to make passed value optional to allow users to run only on physical devices
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ const createBuild =
}

let installedPods = false;
if (platformConfig.automaticPodsInstallation || args.forcePods) {
if (
platformConfig.automaticPodsInstallation ||
args.forcePods ||
args.onlyPods
) {
const isAppRunningNewArchitecture = platformConfig.sourceDir
? await getArchitecture(platformConfig.sourceDir)
: undefined;
Expand All @@ -43,6 +47,10 @@ const createBuild =
installedPods = true;
}

if (args.onlyPods) {
return;
}

let {xcodeProject, sourceDir} = getXcodeProjectAndDir(
platformConfig,
platformName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ const createRun =
let {packager, port} = args;
let installedPods = false;
// check if pods need to be installed
if (platformConfig.automaticPodsInstallation || args.forcePods) {
if (
platformConfig.automaticPodsInstallation ||
args.forcePods ||
args.onlyPods
) {
const isAppRunningNewArchitecture = platformConfig.sourceDir
? await getArchitecture(platformConfig.sourceDir)
: undefined;
Expand All @@ -98,6 +102,10 @@ const createRun =
installedPods = true;
}

if (args.onlyPods) {
return;
}

if (packager) {
const {port: newPort, startPackager} = await findDevServerPort(
port,
Expand Down
8 changes: 8 additions & 0 deletions packages/cli-platform-ios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ List all available iOS devices and simulators and let you choose one to run the

Force running `pod install` before running an app

#### `--only-pods`,

Only install Cocoapods, do not build the app.

### `build-ios`

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

Force running `pod install` before building an app

#### `--only-pods`,

Only install Cocoapods, do not build the app.

### `log-ios`

Usage:
Expand Down
Loading