Skip to content

fix(clean): resolve CocoaPods paths from project and home directories - #2862

Open
xu1132 wants to merge 1 commit into
react-native-community:mainfrom
xu1132:fix/cocoapods-clean-paths
Open

xu1132 wants to merge 1 commit into
react-native-community:mainfrom
xu1132:fix/cocoapods-clean-paths

Conversation

@xu1132

@xu1132 xu1132 commented Sep 23, 2026

Copy link
Copy Markdown

Summary

clean --include cocoapods passes ~/.cocoapods directly to filesystem APIs, which do not expand the tilde. It also removes ios/Pods relative to the current working directory rather than the selected project. This leaves the intended caches behind and can clean the wrong project when running from another directory.

Resolve the spec cache using os.homedir(), and resolve installed pods from project.ios.sourceDir, falling back to ios under --project-root. Document the CocoaPods cleaning paths.

Test Plan

Validated with Node 22.16.0:

  • Added three filesystem regression cases to the existing clean suite. On the original source: 3 failed, 5 passed. After the fix: 8 passed.
  • The tests create temporary home, project, and working directories. They verify removal of the intended spec cache and Pods directory (default and custom sourceDir), while preserving unrelated ios/Pods and literal ~/.cocoapods directories in the working directory. The external pod command is mocked.
  • Full package unit suite: 55 suites passed, 316 tests passed, 1 todo, 62 snapshots passed.
  • yarn build, including TypeScript declarations: passed.
  • yarn lint: passed with two existing warnings in unchanged files.
  • git diff --check: passed.

No real user CocoaPods cache was cleaned and no native React Native checkout integration test was performed.

Checklist

  • Documentation is up to date.
  • Follows commit message convention described in CONTRIBUTING.md.
  • For functional changes, my test plan has linked these CLI changes into a local react-native checkout (instructions).

@xu1132
xu1132 requested a review from thymikee as a code owner September 23, 2026 23:59
@github-actions github-actions Bot added bugfix docs Documentation change labels Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix docs Documentation change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant