@@ -5,21 +5,26 @@ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
55fabric_enabled = ENV [ 'RCT_NEW_ARCH_ENABLED' ] == '1'
66
77# Detect if this is a Swift project by checking common iOS project locations
8- # This avoids the slow recursive Find.find() that can take minutes in CI
8+ # Avoid recursive directory scanning which can be slow in CI with large node_modules
99start_dir = File . expand_path ( '../../' , __dir__ )
1010swift_delegate_path = nil
1111
12- # Common project directory names to check
12+ # Check specific, known locations where AppDelegate.swift typically exists
13+ # This avoids slow recursive directory traversal
1314[ 'ios' , 'example/ios' , 'playground/ios' , 'app/ios' , 'demo/ios' ] . each do |ios_dir |
1415 ios_path = File . join ( start_dir , ios_dir )
1516 next unless Dir . exist? ( ios_path )
1617
17- # Check common AppDelegate.swift locations within ios directory
18- Dir . glob ( File . join ( ios_path , '**/AppDelegate.swift' ) , File ::FNM_DOTMATCH ) . each do |path |
19- # Exclude Pods, build, and DerivedData directories
20- next if path =~ /\/ (Pods|build|DerivedData)\/ /
21- if File . exist? ( path )
22- swift_delegate_path = path
18+ # Check direct subdirectories (common project structures)
19+ # Most projects have: ios/ProjectName/AppDelegate.swift
20+ Dir . entries ( ios_path ) . each do |entry |
21+ next if entry . start_with? ( '.' ) || entry == 'Pods' || entry == 'build' || entry == 'DerivedData'
22+ entry_path = File . join ( ios_path , entry )
23+ next unless Dir . exist? ( entry_path )
24+
25+ app_delegate_path = File . join ( entry_path , 'AppDelegate.swift' )
26+ if File . exist? ( app_delegate_path )
27+ swift_delegate_path = app_delegate_path
2328 break
2429 end
2530 end
0 commit comments