1#!/usr/bin/env bash 2 3echo " ☛ Ensuring Android project is setup..." 4 5if [ -d "./node_modules" ]; then 6 echo " ✅ Node modules installed" 7else 8 echo " ⚠️ Cannot find node modules for this project, installing..." 9 yarn 10fi 11 12# 1. yarn why react-native : ... Found "[email protected]" ... 13# 2. grep Found : Found "[email protected]" 14# 3. cut -d '@' -f2 : 0.62.2" 15# 4. rev : "2.26.0 16# 5. cut -c 2- : 2.26.0 17# 6. rev : 0.62.2 18REACT_NATIVE_VERSION=$(yarn why react-native | grep Found | cut -d '@' -f2 | rev | cut -c 2- | rev) 19 20if [ -d "node_modules/react-native/android/com/facebook/react/react-native/$REACT_NATIVE_VERSION" ]; then 21 echo " ✅ React Android is installed" 22else 23 echo " ⚠️ Compiling React Android (~5-10 minutes)..." 24 25 if [ ! -f "../../react-native-lab/react-native/local.properties" ]; then 26 # Copying local.properties to react-native-lab since it may come in handy 27 if [ -f "../../android/local.properties" ]; then 28 cp ../../android/local.properties ../../react-native-lab/react-native 29 echo " ✅ local.properties copied from Expo client Android project" 30 else 31 echo " ⚠️ No local.properties found, the build may fail if you have no required (ANDROID_*) env variables set" 32 fi 33 fi 34 35 # Go to our fork of React Native 36 cd ../../react-native-lab/react-native 37 # Build the AARs (~5-10 minutes) 38 ./gradlew :ReactAndroid:installArchives 39 # Come back to the project 40 cd ../../apps/bare-expo 41 42 echo " ✅ React Android is now installed!" 43fi 44