Commit 7c966c3
fix(create-app): preserve existing arg list when patching Podfile (#703)
* fix(create-app): preserve existing arg list when patching Podfile
`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 #702
* chore: add changeset
---------
Co-authored-by: Tomáš Kalina <tomas.kalina@team.blue>1 parent bfe317d commit 7c966c3
3 files changed
Lines changed: 85 additions & 4 deletions
File tree
- .changeset
- packages/create-app/src/lib/utils
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 71 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
| 274 | + | |
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
280 | 286 | | |
281 | | - | |
282 | | - | |
| 287 | + | |
| 288 | + | |
283 | 289 | | |
284 | 290 | | |
285 | 291 | | |
| |||
0 commit comments