1919printf " ${GREEN} Setting up initial package links...\n${NC} "
2020{
2121 # First ensure react-native exists in root node_modules for patch-package
22- if [ ! -e " node_modules/react-native" ]; then
22+ if [ ! -e " node_modules/react-native" ] && [ -e " ./packages/mobile/node_modules/react-native " ] ; then
2323 printf " ${GREEN} Moving react-native to root node_modules...\n${NC} "
2424 cp -R ./packages/mobile/node_modules/react-native ./node_modules/
2525 rm -rf ./packages/mobile/node_modules/react-native
2626 fi
2727
28- cd ./packages/mobile/node_modules
28+ if [ -d " ./packages/mobile/node_modules" ]; then
29+ cd ./packages/mobile/node_modules
2930
30- # Link react-native-code-push from root since it's not in mobile/node_modules
31- source_path=../../../node_modules/react-native-code-push
32- target_path=react-native-code-push
33- if [ ! -e " $target_path " ]; then
34- ln -s " $source_path " " $target_path "
35- fi
31+ # Link react-native-code-push from root since it's not in mobile/node_modules
32+ source_path=../../../node_modules/react-native-code-push
33+ target_path=react-native-code-push
34+ if [ ! -e " $target_path " ]; then
35+ ln -s " $source_path " " $target_path "
36+ fi
3637
37- cd ../../..
38+ cd ../../..
39+ fi
3840} > /dev/null
3941
4042printf " ${GREEN} Applying patches...\n${NC} "
@@ -43,7 +45,7 @@ npm run patch-package > /dev/null
4345printf " ${GREEN} Moving react-native back to mobile...\n${NC} "
4446{
4547 # Move react-native back to mobile/node_modules for pod install
46- if [ -e " node_modules/react-native" ]; then
48+ if [ -e " node_modules/react-native" ] && [ -d " ./packages/mobile/node_modules " ] ; then
4749 rm -rf ./packages/mobile/node_modules/react-native
4850 mv ./node_modules/react-native ./packages/mobile/node_modules/
4951 # Create symlink back to root
0 commit comments