Skip to content

feat: use ruby script for post integrate#233

Merged
thymikee merged 106 commits intomainfrom
feat/use-script-for-post-integrate
Feb 20, 2026
Merged

feat: use ruby script for post integrate#233
thymikee merged 106 commits intomainfrom
feat/use-script-for-post-integrate

Conversation

@hurali97
Copy link
Copy Markdown
Member

@hurali97 hurali97 commented Feb 19, 2026

Summary

This PR reduces the clutter from the consumer's Expo App's Podfile by leveraging a ruby script for handling the post_integrate implementation. This follows the same way expo and react-native adds their implementation in the Podfile.

See the diff below to understand the impact of this change:

diff --git a/Podfile b/Podfile
index 2d58308..075afd1 100644
--- a/Podfile
+++ b/Podfile
@@ -1,6 +1,8 @@
 require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
 require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
 
+require File.join(File.dirname(`node --print "require.resolve('@callstack/react-native-brownfield/package.json')"`), "scripts/react_native_brownfield_post_integrate")
+
 require 'json'
 podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
 
@@ -68,31 +70,8 @@ end
 
 
 # >>> react-native-brownfield expo phase ordering >>>
-def reorder_brownfield_expo_patch_phase!(installer)
-  projects = installer.aggregate_targets.map(&:user_project).compact.uniq
-  projects.each do |project|
-    modified = false
-
-    project.native_targets.each do |target|
-      phases = target.build_phases
-      expo_idx = phases.index { |p| p.respond_to?(:name) && p.name == '[Expo] Configure project' }
-      patch_idx = phases.index { |p| p.respond_to?(:name) && p.name == 'Patch ExpoModulesProvider' }
-
-      next if expo_idx.nil? || patch_idx.nil?
-      next if patch_idx > expo_idx
-
-      patch = phases.delete_at(patch_idx)
-      expo_idx = phases.index { |p| p.respond_to?(:name) && p.name == '[Expo] Configure project' }
-      phases.insert(expo_idx + 1, patch)
-      modified = true
-    end
-
-    project.save if modified
-  end
-end
-
 post_integrate do |installer|
-  reorder_brownfield_expo_patch_phase!(installer)
+  react_native_brownfield_post_integrate(installer)
 end
 # <<< react-native-brownfield expo phase ordering <<<

The consumer's Expo App's Podfile only references the import to the Ruby script and calls the function from there.

Test plan

CI passes - 🟢

artus9033 and others added 30 commits January 16, 2026 13:21
…id deps to be properly resolved by Gradle when consumed
@thymikee
Copy link
Copy Markdown
Member

what does this solve?

Base automatically changed from feat/expo-config-plugin to main February 19, 2026 12:21
@hurali97 hurali97 marked this pull request as ready for review February 20, 2026 05:38
Copilot AI review requested due to automatic review settings February 20, 2026 05:38
@hurali97
Copy link
Copy Markdown
Member Author

what does this solve?

@thymikee - Updated the description. TLDR; instead of directly adding the post_integrate implementation to the consumer Expo App's Podfile, we use the same behavior as of RN and Expo to reference a custom script and call a method from there, which contains the implementation. This reduces the clutter from the Podfile.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR streamlines how the Expo consumer app’s Podfile implements the post_integrate hook by moving the phase-reordering logic into a reusable Ruby script shipped with @callstack/react-native-brownfield, aligning with the pattern used by Expo and React Native.

Changes:

  • Inject a require for a new Brownfield Ruby script into the consumer Podfile (when needed).
  • Replace the inline post_integrate implementation with a call to react_native_brownfield_post_integrate(installer).
  • Publish the new scripts/ directory as part of the npm package.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/react-native-brownfield/src/expo-config-plugin/ios/podfileHelpers.ts Ensures the Ruby script is required and updates the inserted post_integrate hook to call into the script.
packages/react-native-brownfield/scripts/react_native_brownfield_post_integrate.rb Introduces the extracted post_integrate implementation for Expo phase ordering.
packages/react-native-brownfield/package.json Adds scripts/ to the published package contents so the Podfile require can resolve at install time.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s rebase it to main and go

@thymikee thymikee merged commit 5a18a76 into main Feb 20, 2026
12 of 13 checks passed
@thymikee thymikee deleted the feat/use-script-for-post-integrate branch February 20, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants