Skip to content

Add prepare-ios-dependencies command for technology-agnostic iOS dependency management #2702

@fabiendem

Description

@fabiendem

Describe the Feature

As React Native transitions from CocoaPods to Swift Package Manager (SPM) for iOS dependency management, the community is moving away from direct pod install usage. While developers currently rely on CocoaPods for dependency management, the upcoming migration to SPM will require a new approach for projects that don't use the CLI's build-ios command (e.g., those with custom build scripts, CI/CD pipelines, or manual Xcode builds).

This feature request proposes adding a new CLI command that prepares iOS dependencies in a technology-agnostic manner, serving as the modern replacement for direct pod install usage while supporting the ecosystem's evolution toward SPM.

Possible Implementations

Add a new CLI command with a name like prepare-ios-dependencies or install-ios-deps that reuses the existing CocoaPods/SPM installation logic from the current run-ios and build-ios commands:

  1. Reuse Existing Logic: Extract and reuse the dependency resolution logic already implemented in run-ios and build-ios commands
  2. Technology Detection: Leverage the same detection mechanisms used by existing commands to identify CocoaPods vs SPM projects
  3. Dependency Resolution: Execute the same dependency installation process without the build phase:
    • For CocoaPods projects: runs the same pod install logic as run-ios/build-ios
    • For SPM projects: performs the same Swift package resolution as existing commands
    • For hybrid setups: handles both dependency managers using existing patterns
  4. CI/CD Friendly: Provides options for non-interactive mode and clear exit codes for automation
  5. Consistency: Ensures identical dependency resolution behavior across all CLI commands

Example usage:

npx react-native prepare-ios-dependencies
npx react-native prepare-ios-dependencies --verbose
npx react-native prepare-ios-dependencies --ci

This command would be particularly valuable for:

  • Custom build processes that don't use build-ios
  • CI/CD pipelines requiring explicit dependency preparation steps
  • Developers who build through Xcode directly
  • Projects with complex dependency management needs

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions