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

perf: move pods installation from init to ios-specific commands #2077

Merged

Conversation

TMisiukiewicz
Copy link
Collaborator

@TMisiukiewicz TMisiukiewicz commented Sep 15, 2023

Summary:

Currently Pods are installed during init command, what makes project setup much longer than it supposed to be. This change makes pods installation optional during the init command by displaying the prompt, and moves the installation process to the run-ios and build-ios commands. Pods are automatically installed when running ios-specific commands and:

  • they were not installed before
  • a new dependency/devDependency was introduced in package.json
  • new flag --force-pods was used, which forces to install pods (might be helpful when there are any errors related to pods)

Additionally, new flag --install-pods was introduced to init command, to avoid displaying prompt. If set to true, pods will install, false will skip the installation, and when not used, prompt will be displayed.

To install pods during *-ios command, it compares md5 hashes of native dependencies names and its versions. To achieve this, I added one new field to dependency config: version which holds the version of the library from package.json/podspec file.

Demo

1. init with prompt

Screen.Recording.2023-09-19.at.10.27.12.mov

2. init with --install-pods false - skip prompt and pods installation

Screen.Recording.2023-09-19.at.10.18.10.mov

3. run-ios for the first time (cut the video because it takes too long 😄, app runs after installation)

run-ios.mov

Test Plan:

  1. Follow the contributing instructions
  2. Init new project - it should display prompt about pods installation
  3. Press y to confirm - pods should be installed
  4. Init new project once again - it should display prompt
  5. Press 'n' - pods installation should be skipped
  6. Init new project with --install-pods flag - pods should be installed automatically
  7. Init new project with --install-pods false - prompt & pods installation should be skipped
  8. Run run-ios command and verify pods are installed before building the app
  9. Run run-ios again and verify app is built without installing pods
  10. Install any random dependency, e.g. @react-navigation/native
  11. Run run-ios again and verify pods are installed before building the app
  12. Run run-ios again and verify app is built without installing pods
  13. Run run-ios --force-pods and verify pods are installed before building the app

Checklist

  • Documentation is up to date to reflect these changes.
  • Follows commit message convention described in CONTRIBUTING.md

@github-actions github-actions bot added the docs Documentation change label Sep 15, 2023
@TMisiukiewicz TMisiukiewicz force-pushed the refactor/pod-installation branch 2 times, most recently from e4675c1 to 3615491 Compare September 18, 2023 06:35
@TMisiukiewicz TMisiukiewicz force-pushed the refactor/pod-installation branch 2 times, most recently from 0611e23 to 1876e6a Compare September 18, 2023 14:26
@TMisiukiewicz TMisiukiewicz force-pushed the refactor/pod-installation branch 4 times, most recently from 979f872 to d35c42a Compare September 19, 2023 09:18
@TMisiukiewicz TMisiukiewicz force-pushed the refactor/pod-installation branch from d35c42a to 5f386b4 Compare September 21, 2023 07:13
@thymikee thymikee merged commit d011058 into react-native-community:main Sep 21, 2023
@thymikee thymikee changed the title refactor: move pods installation from init to ios-specific commands perf: move pods installation from init to ios-specific commands Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants