1#!/usr/bin/env bash 2 3set -euo pipefail 4 5port=${2:-8081} 6CURRENT_ENV=${NODE_ENV:-"development"} 7 8DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 9 10echo " ☛ Bootstrapping Expo in ${CURRENT_ENV} mode" 11 12"$DIR/setup-ios-project.sh" 13 14"$DIR/start-metro.sh" "$port" 15 16if [ "${CURRENT_ENV}" = "test" ]; then 17 if command -v applesimutils > /dev/null; then 18 # if brew ls --versions applesimutils > /dev/null; then 19 echo " ✅ Detox simulators are installed" 20 else 21 echo "Detox simulators are not installed, installing..." 22 brew tap wix/brew 23 brew install applesimutils 24 fi 25 26 if [ -d "ios/build/Build/Products/Debug-iphonesimulator/BareExpo.app" ]; then 27 echo " ✅ Debug Detox project is built for iOS" 28 else 29 echo " ⚠️ Building the debug Detox project..." 30 yarn run ios:detox:build:debug 31 fi 32 33 echo " ☛ Opening the iOS simulator app" 34 # Detox requires that the app is opened before it can connect 35 open -a "Simulator" 36 37 echo " ☛ Starting Detox in watch mode" 38 # Run our default E2E tests 39 yarn run ios:detox:test:debug --watch 40else 41 42 echo " ☛ Running the iOS project..." 43 44 # CONNECTED_DEVICE=$(node ios-deploy -c | grep -oE 'Found ([0-9A-Za-z\-]+)' | sed 's/Found //g') 45 # if [ -z "${CONNECTED_DEVICE}" ]; then 46 # Build and run the iOS project using `react-native run-ios` 47 node "node_modules/react-native/cli.js" run-ios --no-packager --port "$port" 48 # else 49 # # Build and run the iOS project using `react-native run-ios` 50 # node "node_modules/react-native/cli.js" run-ios --no-packager --udid ${CONNECTED_DEVICE} --port ${port} 51 # fi 52fi 53 54