fix(create-app): preserve existing arg list when patching Podfile#703
Open
TomKalina wants to merge 1 commit into
Open
fix(create-app): preserve existing arg list when patching Podfile#703TomKalina wants to merge 1 commit into
TomKalina wants to merge 1 commit into
Conversation
`updatePodfile` ran a regex that matched `config = use_native_modules!`
plus the whitespace after `!`, but not any existing argument tuple.
That works for Community-CLI Podfile templates (call has no argument),
but Expo's prebuild template calls it with `config_command` as the
argument. The patch then inserted Rock's array right before the
existing `(config_command)`, leaving two consecutive call expressions
on the same line — invalid Ruby:
config = use_native_modules!(['npx', 'rock', 'config', '-p', 'ios'])(config_command)
^ unexpected '('
Every subsequent `pod install` (and `rock run:ios`) failed on Expo
projects after `npm create rock`.
Fix: extend the regex to also consume any existing parenthesized
argument list, so it gets replaced in full. On Community-CLI Podfiles
the optional group matches nothing — behaviour is unchanged. On Expo
prebuild Podfiles the existing `(config_command)` is now consumed and
replaced cleanly.
Adds four `updatePodfile` test cases:
- Community-CLI template (bare `use_native_modules!`)
- Expo prebuild template (`use_native_modules!(config_command)`)
- Idempotency on an already-patched Podfile
- Missing Podfile is a no-op
The `updatePodfile` function is now exported for testability, mirroring
the existing `updateAndroidBuildGradle` export.
Fixes callstackincubator#702
|
Someone is attempting to deploy a commit to the Callstack Team on Vercel. A member of the Team first needs to authorize it. |
Member
|
Mind adding a changeset with "patch" change? |
This was referenced May 12, 2026
TomKalina
pushed a commit
to TomKalina/rock
that referenced
this pull request
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #702 —
npm create rockproduces an invalidios/Podfileon Expo prebuild projects.updatePodfileinpackages/create-app/src/lib/utils/initInExistingProject.tsran a regex that matchedconfig = use_native_modules!plus the whitespace after!, but not any existing argument list. That worked for the Community-CLI Podfile template (which callsuse_native_modules!with no arguments), but Expo's prebuild template calls it withconfig_commandas the argument. The patch then inserted Rock's array right before the existing(config_command), leaving two consecutive call expressions on the same line — invalid Ruby:Every subsequent
pod install(and therefore everyrock run:ios) failed on Expo projects afternpm create rock.Fix
Extend the regex to also consume any existing parenthesized argument list, so it gets replaced in full:
On Community-CLI Podfiles the optional group matches nothing — behaviour is unchanged. On Expo prebuild Podfiles the existing
(config_command)is now consumed and replaced cleanly.Tests
Added four
updatePodfilecases topackages/create-app/src/lib/utils/__tests__/initInExistingProject.test.ts:use_native_modules!) — regression coverage for the old happy pathuse_native_modules!(config_command)) — the case create-app: Podfile patch leaves invalid Ruby on Expo prebuild projects #702 reportsupdatePodfileis now exported, mirroring the existingupdateAndroidBuildGradleexport used by neighbouring tests.Verified manually
In a fresh Expo SDK 55 / RN 0.83 project with prebuilt
ios/:npm create rock→ broken Podfile →pnpm rock run:iosfails withunexpected '('inpod install.npm create rock→ Podfile line isconfig = use_native_modules!(['npx', 'rock', 'config', '-p', 'ios'])→pod installproceeds normally.Notes
($2→(\s*)$2)in the old regex was unnecessary — whitespace following the match was not being consumed by the regex anyway, so dropping the second capture has no behavioural impact beyond simpler substitution.use_native_modules!(config_command)for a long time; this fix unlocks migration for every Expo-CNG project, not just SDK 55.