-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
54 lines (47 loc) · 1.66 KB
/
Copy pathdev.sh
File metadata and controls
54 lines (47 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Dev script — reads credentials from lib/services/local_config.dart
# and passes them via --dart-define.
#
# Usage:
# bash dev.sh # run in debug mode
# bash dev.sh windows # build windows release
# bash dev.sh apk # build android release
set -e
export PATH="/c/flutter/bin:$PATH"
cd "$(dirname "$0")"
CONFIG="lib/services/local_config.dart"
if [ ! -f "$CONFIG" ]; then
echo "⚠️ lib/services/local_config.dart not found!"
echo " Create it with your Supabase credentials:"
echo " const String localSupabaseUrl = 'https://your-project.supabase.co';"
echo " const String localSupabaseAnonKey = 'your-publishable-key';"
exit 1
fi
# Parse credential values robustly: they may sit on the same line as the
# declaration or wrapped onto the next line (dart format moves them there).
URL=$(grep -A1 'localSupabaseUrl' "$CONFIG" | grep -o "'[^']*'" | head -1 | tr -d "'")
KEY=$(grep -A1 'localSupabaseAnonKey' "$CONFIG" | grep -o "'[^']*'" | head -1 | tr -d "'")
if [ -z "$URL" ] || [ -z "$KEY" ]; then
echo "⚠️ Could not parse credentials from $CONFIG"
exit 1
fi
DART_DEFINES="--dart-define=SUPABASE_URL=$URL --dart-define=SUPABASE_ANON_KEY=$KEY"
case "${1:-run}" in
run)
echo "🚀 Running GoWorkBro (debug)..."
flutter run $DART_DEFINES
;;
windows)
echo "🏗️ Building Windows release..."
flutter build windows --release $DART_DEFINES
;;
apk)
echo "🏗️ Building Android APK..."
export JAVA_HOME="C:/Program Files/Eclipse Adoptium/jdk-21.0.11.10-hotspot"
flutter build apk --release $DART_DEFINES
;;
*)
echo "Usage: bash dev.sh [run|windows|apk]"
exit 1
;;
esac