@@ -23,7 +23,10 @@ describe("generateProject()", macosOnly, () => {
2323 return generateProjectActual ( projectRoot , platform , options , mockfs ) ;
2424 }
2525
26- function makeMockProject ( overrides ?: Record < string , unknown > ) {
26+ function makeMockProject (
27+ overrides ?: Record < string , unknown > ,
28+ reactNativeVersion = "1000.0.0"
29+ ) {
2730 const manifestURL = new URL ( "../../package.json" , import . meta. url ) ;
2831 const manifest = readTextFile ( fileURLToPath ( manifestURL ) ) ;
2932 const { name, version, defaultPlatformPackages } = JSON . parse ( manifest ) ;
@@ -58,15 +61,21 @@ describe("generateProject()", macosOnly, () => {
5861 "node_modules/@callstack/react-native-visionos/package.json" :
5962 JSON . stringify ( {
6063 name : "@callstack/react-native-visionos" ,
61- version : "1000.0.0" ,
64+ version : reactNativeVersion ,
6265 } ) ,
66+ "node_modules/@react-native-community/cli-platform-ios/native_modules.rb" :
67+ "" ,
68+ "node_modules/@rnx-kit/react-native-host/package.json" : JSON . stringify ( {
69+ name : "@rnx-kit/react-native-host" ,
70+ version : reactNativeVersion ,
71+ } ) ,
6372 "node_modules/react-native/package.json" : JSON . stringify ( {
6473 name : "react-native" ,
65- version : "1000.0.0" ,
74+ version : reactNativeVersion ,
6675 } ) ,
6776 "node_modules/react-native-macos/package.json" : JSON . stringify ( {
6877 name : "react-native-macos" ,
69- version : "1000.0.0" ,
78+ version : reactNativeVersion ,
7079 } ) ,
7180 } ;
7281 }
@@ -214,6 +223,17 @@ describe("generateProject()", macosOnly, () => {
214223
215224 deepEqual ( trimPaths ( result , cwd ) , PROJECT_FILES . customReactNative ) ;
216225 } ) ;
226+
227+ it ( "finds community autolinking script for older versions" , ( ) => {
228+ setMockFiles ( makeMockProject ( undefined , "0.74.0" ) ) ;
229+
230+ const result = generateProject ( "ios" , "ios" , { } ) ;
231+
232+ equal (
233+ result . communityAutolinkingScriptPath ,
234+ "node_modules/@react-native-community/cli-platform-ios/native_modules.rb"
235+ ) ;
236+ } ) ;
217237} ) ;
218238
219239const PROJECT_FILES = {
@@ -232,6 +252,8 @@ const PROJECT_FILES = {
232252 PRODUCT_VERSION : "1.0" ,
233253 USER_HEADER_SEARCH_PATHS : [ "/~/node_modules/.generated" ] ,
234254 } ,
255+ communityAutolinkingScriptPath : undefined ,
256+ reactNativeHostPath : "../node_modules/@rnx-kit/react-native-host" ,
235257 reactNativePath : "/~/node_modules/react-native-macos" ,
236258 reactNativeVersion : 1000000000 ,
237259 testsBuildSettings : { } ,
@@ -257,6 +279,8 @@ const PROJECT_FILES = {
257279 PRODUCT_VERSION : "1.0" ,
258280 USER_HEADER_SEARCH_PATHS : [ "/~/node_modules/.generated" ] ,
259281 } ,
282+ communityAutolinkingScriptPath : undefined ,
283+ reactNativeHostPath : "../node_modules/@rnx-kit/react-native-host" ,
260284 reactNativePath : "/~/node_modules/react-native" ,
261285 reactNativeVersion : 1000000000 ,
262286 testsBuildSettings : { } ,
@@ -288,6 +312,8 @@ const PROJECT_FILES = {
288312 "/visionos/ReactTestAppUITests/Info.plist" ,
289313 "/package.json" ,
290314 "/node_modules/@callstack/react-native-visionos/package.json" ,
315+ "/node_modules/@react-native-community/cli-platform-ios/native_modules.rb" ,
316+ "/node_modules/@rnx-kit/react-native-host/package.json" ,
291317 "/node_modules/react-native/package.json" ,
292318 "/node_modules/react-native-macos/package.json" ,
293319 "/node_modules/.generated/ios/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme" ,
@@ -316,6 +342,8 @@ const PROJECT_FILES = {
316342 PRODUCT_VERSION : "1.0" ,
317343 USER_HEADER_SEARCH_PATHS : [ "/~/node_modules/.generated" ] ,
318344 } ,
345+ communityAutolinkingScriptPath : undefined ,
346+ reactNativeHostPath : "../node_modules/@rnx-kit/react-native-host" ,
319347 reactNativePath : "/~/node_modules/react-native-macos" ,
320348 reactNativeVersion : 1000000000 ,
321349 testsBuildSettings : { } ,
@@ -348,6 +376,8 @@ const PROJECT_FILES = {
348376 "/visionos/ReactTestAppUITests/Info.plist" ,
349377 "/package.json" ,
350378 "/node_modules/@callstack/react-native-visionos/package.json" ,
379+ "/node_modules/@react-native-community/cli-platform-ios/native_modules.rb" ,
380+ "/node_modules/@rnx-kit/react-native-host/package.json" ,
351381 "/node_modules/react-native/package.json" ,
352382 "/node_modules/react-native-macos/package.json" ,
353383 "/node_modules/.generated/macos/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme" ,
@@ -376,6 +406,8 @@ const PROJECT_FILES = {
376406 PRODUCT_VERSION : "1.0" ,
377407 USER_HEADER_SEARCH_PATHS : [ "/~/node_modules/.generated" ] ,
378408 } ,
409+ communityAutolinkingScriptPath : undefined ,
410+ reactNativeHostPath : "../node_modules/@rnx-kit/react-native-host" ,
379411 reactNativePath : "/~/node_modules/@callstack/react-native-visionos" ,
380412 reactNativeVersion : 1000000000 ,
381413 testsBuildSettings : { } ,
@@ -408,6 +440,8 @@ const PROJECT_FILES = {
408440 "/visionos/.xcode.env" ,
409441 "/package.json" ,
410442 "/node_modules/@callstack/react-native-visionos/package.json" ,
443+ "/node_modules/@react-native-community/cli-platform-ios/native_modules.rb" ,
444+ "/node_modules/@rnx-kit/react-native-host/package.json" ,
411445 "/node_modules/react-native/package.json" ,
412446 "/node_modules/react-native-macos/package.json" ,
413447 "/node_modules/.generated/visionos/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme" ,
@@ -432,6 +466,8 @@ const PROJECT_FILES = {
432466 PRODUCT_VERSION : "1.0" ,
433467 USER_HEADER_SEARCH_PATHS : [ "/~/node_modules/.generated" ] ,
434468 } ,
469+ communityAutolinkingScriptPath : undefined ,
470+ reactNativeHostPath : "../node_modules/@rnx-kit/react-native-host" ,
435471 reactNativePath : "/~/node_modules/react-native" ,
436472 reactNativeVersion : 1000000000 ,
437473 testsBuildSettings : { } ,
@@ -463,6 +499,8 @@ const PROJECT_FILES = {
463499 "/visionos/ReactTestAppUITests/Info.plist" ,
464500 "/package.json" ,
465501 "/node_modules/@callstack/react-native-visionos/package.json" ,
502+ "/node_modules/@react-native-community/cli-platform-ios/native_modules.rb" ,
503+ "/node_modules/@rnx-kit/react-native-host/package.json" ,
466504 "/node_modules/react-native/package.json" ,
467505 "/node_modules/react-native-macos/package.json" ,
468506 "/node_modules/.generated/ios/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme" ,
@@ -485,6 +523,8 @@ const PROJECT_FILES = {
485523 PRODUCT_VERSION : "1.0" ,
486524 USER_HEADER_SEARCH_PATHS : [ "/~/node_modules/.generated" ] ,
487525 } ,
526+ communityAutolinkingScriptPath : undefined ,
527+ reactNativeHostPath : "../node_modules/@rnx-kit/react-native-host" ,
488528 reactNativePath : "/~/node_modules/react-native-macos" ,
489529 reactNativeVersion : 1000000000 ,
490530 testsBuildSettings : { } ,
@@ -517,6 +557,8 @@ const PROJECT_FILES = {
517557 "/visionos/ReactTestAppUITests/Info.plist" ,
518558 "/package.json" ,
519559 "/node_modules/@callstack/react-native-visionos/package.json" ,
560+ "/node_modules/@react-native-community/cli-platform-ios/native_modules.rb" ,
561+ "/node_modules/@rnx-kit/react-native-host/package.json" ,
520562 "/node_modules/react-native/package.json" ,
521563 "/node_modules/react-native-macos/package.json" ,
522564 "/node_modules/.generated/macos/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme" ,
@@ -539,6 +581,8 @@ const PROJECT_FILES = {
539581 PRODUCT_VERSION : "1.0" ,
540582 USER_HEADER_SEARCH_PATHS : [ "/~/node_modules/.generated" ] ,
541583 } ,
584+ communityAutolinkingScriptPath : undefined ,
585+ reactNativeHostPath : "../node_modules/@rnx-kit/react-native-host" ,
542586 reactNativePath : "/~/node_modules/@callstack/react-native-visionos" ,
543587 reactNativeVersion : 1000000000 ,
544588 testsBuildSettings : { } ,
@@ -571,6 +615,8 @@ const PROJECT_FILES = {
571615 "/visionos/.xcode.env" ,
572616 "/package.json" ,
573617 "/node_modules/@callstack/react-native-visionos/package.json" ,
618+ "/node_modules/@react-native-community/cli-platform-ios/native_modules.rb" ,
619+ "/node_modules/@rnx-kit/react-native-host/package.json" ,
574620 "/node_modules/react-native/package.json" ,
575621 "/node_modules/react-native-macos/package.json" ,
576622 "/node_modules/.generated/visionos/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme" ,
0 commit comments