Commit 2a222b2
fix(macos-init): improve init flow and drop chalk dependency (#2858)
## Summary
- Remove redundant dependency install (`generate-macos.js` was running
`npm i`/`yarn` a second time after `cli.ts` already installed
`react-native-macos`)
- Show actual npm/yarn errors on install failure instead of swallowing
them with `--silent`
- Validate peer dependencies before install and warn on version mismatch
- Fix finish message: remove nonexistent `yarn start:macos`, show
correct `pod install`, `npx react-native run-macos` and `npx
react-native start`
- Replace `chalk` with Node's built-in `node:util` `styleText`
(available since Node 20.12), add `engines.node` field
- Re-enable integration test CI without Verdaccio (fixes #2344) —
installs local package directly via `npm install <path>`
## Motivation
Users hitting `npx react-native-macos-init` frequently encounter silent
failures from peer dependency mismatches (e.g.
`react-native-macos@0.81.4` requires `react-native@0.81.6` exactly, but
`--version 0.81` installs the latest patch). The `--silent` flag hid the
actual error. The finish message referenced a nonexistent `yarn
start:macos` script.
Addresses the same root issue as #2785 and #2793 but with a broader fix.
## Test plan
- [x] Created a new project with `npx @react-native-community/cli init
testapp --version 0.81.6`
- [x] Ran modified init — happy path: no peer dep warning, correct
finish message
- [x] Tested mismatch path (`react-native@0.81.5` vs required `0.81.6`)
— warning fires before install with clear message
- [x] TypeScript compiles cleanly
- [x] Re-enabled CI integration test (no longer depends on Verdaccio)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 62b2545 commit 2a222b2
File tree
8 files changed
+150
-118
lines changed- .github/workflows
- packages
- react-native-macos-init
- src
- react-native/local-cli
- generator-common
- generator-macos
8 files changed
+150
-118
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
142 | 140 | | |
143 | 141 | | |
144 | 142 | | |
| |||
158 | 156 | | |
159 | 157 | | |
160 | 158 | | |
161 | | - | |
| 159 | + | |
162 | 160 | | |
163 | 161 | | |
164 | 162 | | |
| |||
Lines changed: 11 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
36 | 37 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
51 | 43 | | |
52 | 44 | | |
53 | 45 | | |
54 | 46 | | |
55 | | - | |
| 47 | + | |
56 | 48 | | |
57 | 49 | | |
58 | | - | |
| 50 | + | |
59 | 51 | | |
60 | 52 | | |
61 | 53 | | |
62 | | - | |
63 | | - | |
| 54 | + | |
64 | 55 | | |
65 | 56 | | |
66 | 57 | | |
67 | 58 | | |
68 | 59 | | |
69 | | - | |
70 | | - | |
| 60 | + | |
71 | 61 | | |
72 | 62 | | |
73 | 63 | | |
74 | 64 | | |
75 | 65 | | |
76 | 66 | | |
77 | 67 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | | - | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | | - | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
77 | 81 | | |
78 | 82 | | |
79 | 83 | | |
| |||
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
87 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
88 | 94 | | |
89 | 95 | | |
90 | 96 | | |
| |||
112 | 118 | | |
113 | 119 | | |
114 | 120 | | |
115 | | - | |
116 | | - | |
| 121 | + | |
| 122 | + | |
117 | 123 | | |
118 | 124 | | |
119 | 125 | | |
| |||
208 | 214 | | |
209 | 215 | | |
210 | 216 | | |
211 | | - | |
212 | | - | |
| 217 | + | |
| 218 | + | |
213 | 219 | | |
214 | 220 | | |
215 | 221 | | |
216 | 222 | | |
217 | 223 | | |
218 | 224 | | |
219 | 225 | | |
220 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
221 | 263 | | |
222 | 264 | | |
223 | 265 | | |
| |||
243 | 285 | | |
244 | 286 | | |
245 | 287 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
250 | 295 | | |
251 | 296 | | |
252 | 297 | | |
253 | 298 | | |
254 | 299 | | |
255 | | - | |
| 300 | + | |
| 301 | + | |
256 | 302 | | |
257 | 303 | | |
258 | 304 | | |
259 | 305 | | |
260 | 306 | | |
261 | 307 | | |
262 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
263 | 313 | | |
264 | 314 | | |
265 | 315 | | |
266 | | - | |
| 316 | + | |
| 317 | + | |
267 | 318 | | |
268 | | - | |
| 319 | + | |
269 | 320 | | |
270 | 321 | | |
271 | 322 | | |
| |||
288 | 339 | | |
289 | 340 | | |
290 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
291 | 347 | | |
292 | 348 | | |
293 | 349 | | |
| |||
298 | 354 | | |
299 | 355 | | |
300 | 356 | | |
301 | | - | |
302 | | - | |
| 357 | + | |
| 358 | + | |
303 | 359 | | |
304 | | - | |
305 | 360 | | |
306 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
307 | 389 | | |
308 | 390 | | |
309 | | - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
310 | 395 | | |
311 | 396 | | |
312 | 397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | | - | |
25 | | - | |
26 | 23 | | |
27 | 24 | | |
28 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
| 333 | + | |
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
| 337 | + | |
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
| 354 | + | |
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | | - | |
| 359 | + | |
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| |||
0 commit comments