Skip to content

Commit 74d9d6b

Browse files
committed
chore: launch simul in vscode
1 parent 7e3638b commit 74d9d6b

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed

.vscode/launch.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "iOS Simulator",
6+
"request": "launch",
7+
"type": "node-terminal",
8+
"command": "${workspaceFolder}/.vscode/run_ios.sh",
9+
"cwd": "${workspaceFolder}/Example"
10+
},
11+
{
12+
"name": "Android Emulator",
13+
"request": "launch",
14+
"type": "node-terminal",
15+
"command": "${workspaceFolder}/.vscode/run_android.sh",
16+
"cwd": "${workspaceFolder}/Example"
17+
},
18+
{
19+
"name": "Start Expo",
20+
"request": "launch",
21+
"type": "node-terminal",
22+
"command": "npx expo start --clear",
23+
"cwd": "${workspaceFolder}/Example"
24+
},
25+
{
26+
"name": "iOS Device",
27+
"request": "launch",
28+
"type": "node-terminal",
29+
"command": "npx expo run:ios --device",
30+
"cwd": "${workspaceFolder}/Example"
31+
},
32+
{
33+
"name": "Android Device",
34+
"request": "launch",
35+
"type": "node-terminal",
36+
"command": "npx expo run:android --device",
37+
"cwd": "${workspaceFolder}/Example"
38+
}
39+
]
40+
}

.vscode/run_android.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
echo "🚀 Starting Android Emulator..."
4+
5+
# Change to Example directory
6+
cd "${BASH_SOURCE%/*}/../Example"
7+
8+
# Kill any existing Metro bundler
9+
pkill -f "metro" || true
10+
11+
# Clear Metro cache
12+
echo "🧹 Clearing Metro cache..."
13+
npx expo start --clear &
14+
15+
# Wait for Metro to start
16+
sleep 5
17+
18+
# Check if emulator is running
19+
if ! adb devices | grep -q "emulator"; then
20+
echo "📱 Starting Android emulator..."
21+
# Try to start the first available emulator
22+
emulator -list-avds | head -1 | xargs -I {} emulator -avd {} -no-snapshot-load &
23+
24+
# Wait for emulator to boot
25+
echo "⏳ Waiting for emulator to boot..."
26+
adb wait-for-device
27+
sleep 10
28+
fi
29+
30+
# Run Android
31+
echo "🤖 Launching Android app..."
32+
npx expo run:android
33+
34+
# Keep the terminal open
35+
read -p "Press any key to exit..."

.vscode/run_ios.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
echo "🚀 Starting iOS Simulator..."
4+
5+
# Change to Example directory
6+
cd "${BASH_SOURCE%/*}/../Example"
7+
8+
# Kill any existing Metro bundler
9+
pkill -f "metro" || true
10+
11+
# Clear Metro cache
12+
echo "🧹 Clearing Metro cache..."
13+
npx expo start --clear &
14+
15+
# Wait for Metro to start
16+
sleep 5
17+
18+
# Run iOS
19+
echo "📱 Launching iOS app..."
20+
npx expo run:ios
21+
22+
# Keep the terminal open
23+
read -p "Press any key to exit..."

0 commit comments

Comments
 (0)