Commit e940c8e
committed
feat(spm): auto-redirect non-destructive actions into ios/; fix Flow parse errors
UX: when invoked from the JS root of a standard RN app (cwd === projectRoot,
ios/ subdir exists), automatically run the action inside <projectRoot>/ios
with a yellow banner instead of erroring. Saves the user a read-error /
cd ios / retype-command cycle for the routine path. `clean` keeps refusing
because its destructive scopes (--project, --derived-data, --cache) shouldn't
silently retarget a different directory.
- New `detectStandardRnLayoutRedirect(appRoot, projectRoot)` helper: pure
detection, returns the ios/ subdir or null.
- `describeRnRootMismatch` refactored to delegate to it (public contract
preserved; still used by the clean refuse path).
- main() flips `appRoot` to the redirect target before any sub-script
invocation when the action is non-destructive.
- 4 new unit tests covering the detection helper.
Flow parse-error cleanup (pre-existing, unblocked while in the area):
- spm/download-spm-artifacts.js:637 — type cast moved to a separate binding
so it doesn't sit between `)` and `.member`.
- spm/download-spm-artifacts.js:740/:743 — same pattern for two inline-
returned object literals.
- spm/spm-pbxproj.js:113 — dropped the dangling `/*: any */` cast that
appeared after the trailing `;`; consolidated FlowFixMe to the call line.
- Once the parse errors cleared, the cascading untyped-import on
setup-apple-spm.js:76 resolved automatically.1 parent 7c63971 commit e940c8e
4 files changed
Lines changed: 98 additions & 22 deletions
File tree
- packages/react-native/scripts
- spm
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
650 | | - | |
651 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
652 | 654 | | |
653 | | - | |
| 655 | + | |
654 | 656 | | |
655 | 657 | | |
656 | 658 | | |
| |||
663 | 665 | | |
664 | 666 | | |
665 | 667 | | |
666 | | - | |
667 | 668 | | |
668 | | - | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
669 | 672 | | |
670 | 673 | | |
671 | 674 | | |
672 | | - | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
673 | 689 | | |
674 | 690 | | |
675 | 691 | | |
| |||
1168 | 1184 | | |
1169 | 1185 | | |
1170 | 1186 | | |
1171 | | - | |
| 1187 | + | |
1172 | 1188 | | |
1173 | 1189 | | |
1174 | 1190 | | |
1175 | 1191 | | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
1176 | 1210 | | |
1177 | 1211 | | |
1178 | 1212 | | |
1179 | 1213 | | |
1180 | 1214 | | |
1181 | | - | |
1182 | | - | |
1183 | | - | |
1184 | | - | |
1185 | | - | |
1186 | | - | |
1187 | | - | |
1188 | 1215 | | |
1189 | 1216 | | |
1190 | 1217 | | |
| |||
1376 | 1403 | | |
1377 | 1404 | | |
1378 | 1405 | | |
| 1406 | + | |
1379 | 1407 | | |
1380 | 1408 | | |
1381 | 1409 | | |
| |||
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
199 | 242 | | |
200 | 243 | | |
201 | 244 | | |
| |||
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
635 | | - | |
| 635 | + | |
636 | 636 | | |
637 | | - | |
| 637 | + | |
| 638 | + | |
638 | 639 | | |
639 | 640 | | |
640 | 641 | | |
| |||
732 | 733 | | |
733 | 734 | | |
734 | 735 | | |
735 | | - | |
| 736 | + | |
736 | 737 | | |
737 | 738 | | |
738 | 739 | | |
739 | | - | |
| 740 | + | |
| 741 | + | |
740 | 742 | | |
741 | 743 | | |
742 | | - | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
743 | 749 | | |
744 | 750 | | |
745 | 751 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | 110 | | |
112 | | - | |
113 | | - | |
| 111 | + | |
| 112 | + | |
114 | 113 | | |
115 | 114 | | |
116 | 115 | | |
| |||
0 commit comments