Commit fafd7b5
feat(spm): never auto-scaffold; surface missing manifests at sync AND resolution
A missing community-library Package.swift is a real gap that must be fixed
deliberately (scaffold + patch-package, or upstream), not papered over. Two
changes make it loud and actionable, and remove the auto-scaffold that hid it.
1. init/update no longer auto-scaffold. `runScaffold` now runs ONLY for the
explicit `spm scaffold` action; init/update/sync fall straight through to the
autolinker, which throws MissingManifestError (exit 2 → hard Xcode build
error) for any npm dep lacking a shipped/scaffolded manifest. Removed the
interactive prompt, the --yes/non-TTY auto-accept, and the dry-run/skip
machinery (confirmScaffold deleted). The post-scaffold guidance now points to
patch-package only — the `"postinstall": "spm scaffold"` suggestion is gone,
because auto-restoring on every install would defeat the pressure to fix the
gap (a wiped scaffold SHOULD re-surface the error). reportMissingManifests
now prints a 4-point message (scaffold → patch-package → tell the maintainer
→ returns on a fresh node_modules).
2. Eval-time missing-manifest guard in the generated aggregator Package.swift.
SwiftPM resolves the package graph BEFORE the Xcode "Sync SPM Autolinking"
build phase runs, so a scaffolded library manifest wiped by a node_modules
reset (no committed patch) failed resolution with an opaque "package manifest
cannot be accessed" — the sync-phase message never printed. Manifest eval may
READ the filesystem (only writes are sandboxed), so the aggregator now checks
each referenced library's Package.swift at resolution time and fatalErrors
with the same actionable guidance. The sync generator re-emits the guard every
build, so it is always present for the next resolution. npmName threaded onto
NpmDepRef so the guard names the installed package, not its Swift target.
Verified E2E (/tmp/SpmE2E, remote mode): a wiped library manifest now surfaces
the 4-point message at resolution instead of the opaque error; the explicit
`spm scaffold` still scaffolds; init hard-errors (exit 2) without scaffolding.
323 spm/scripts tests pass; flow/prettier/eslint clean on touched files.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 11869ee commit fafd7b5
4 files changed
Lines changed: 123 additions & 100 deletions
File tree
- packages/react-native/scripts
- spm
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
802 | 802 | | |
803 | 803 | | |
804 | 804 | | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | 805 | | |
825 | 806 | | |
826 | 807 | | |
| |||
978 | 959 | | |
979 | 960 | | |
980 | 961 | | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
981 | 969 | | |
982 | 970 | | |
983 | 971 | | |
984 | 972 | | |
985 | 973 | | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | 974 | | |
991 | 975 | | |
992 | 976 | | |
| |||
1000 | 984 | | |
1001 | 985 | | |
1002 | 986 | | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | 987 | | |
1055 | 988 | | |
1056 | 989 | | |
1057 | 990 | | |
1058 | 991 | | |
1059 | 992 | | |
1060 | 993 | | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
1065 | | - | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
1066 | 997 | | |
1067 | 998 | | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
| 999 | + | |
| 1000 | + | |
1071 | 1001 | | |
1072 | 1002 | | |
1073 | 1003 | | |
| |||
1084 | 1014 | | |
1085 | 1015 | | |
1086 | 1016 | | |
1087 | | - | |
1088 | | - | |
1089 | | - | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
1090 | 1022 | | |
1091 | 1023 | | |
1092 | 1024 | | |
| |||
1681 | 1613 | | |
1682 | 1614 | | |
1683 | 1615 | | |
1684 | | - | |
1685 | | - | |
1686 | | - | |
1687 | | - | |
1688 | | - | |
1689 | | - | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
1690 | 1624 | | |
1691 | 1625 | | |
1692 | 1626 | | |
| |||
Lines changed: 35 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
60 | 90 | | |
61 | 91 | | |
62 | 92 | | |
| |||
823 | 853 | | |
824 | 854 | | |
825 | 855 | | |
826 | | - | |
| 856 | + | |
827 | 857 | | |
828 | 858 | | |
829 | 859 | | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
830 | 864 | | |
831 | 865 | | |
832 | 866 | | |
| |||
Lines changed: 59 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
349 | 356 | | |
350 | 357 | | |
351 | 358 | | |
| |||
771 | 778 | | |
772 | 779 | | |
773 | 780 | | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
774 | 824 | | |
775 | 825 | | |
776 | 826 | | |
| |||
781 | 831 | | |
782 | 832 | | |
783 | 833 | | |
784 | | - | |
| 834 | + | |
785 | 835 | | |
786 | 836 | | |
787 | 837 | | |
| |||
1243 | 1293 | | |
1244 | 1294 | | |
1245 | 1295 | | |
| 1296 | + | |
1246 | 1297 | | |
1247 | 1298 | | |
1248 | 1299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
| |||
0 commit comments