update: build.sh for manual runs.
This commit is contained in:
parent
c23ce74bc4
commit
dfec3fd9e2
30
build.sh
Normal file → Executable file
30
build.sh
Normal file → Executable file
@ -1,4 +1,26 @@
|
|||||||
flutter build web \
|
#!/bin/bash
|
||||||
--dart-define=APPWRITE_PROJECT_ID="$APPWRITE_PROJECT_ID" \
|
|
||||||
--dart-define=APPWRITE_PROJECT_NAME="$APPWRITE_PROJECT_NAME" \
|
# Check if .env file exists
|
||||||
--dart-define=APPWRITE_PUBLIC_ENDPOINT="$APPWRITE_PUBLIC_ENDPOINT"
|
if [ ! -f .env ]; then
|
||||||
|
echo "Error: .env file not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Read .env file and convert it to --dart-define arguments
|
||||||
|
ARGS=""
|
||||||
|
while IFS='=' read -r key value || [ -n "$key" ]; do
|
||||||
|
# Ignore empty lines and comments
|
||||||
|
if [[ -n "$key" && ! "$key" =~ ^# ]]; then
|
||||||
|
ARGS+=" --dart-define=${key}=\"${value}\""
|
||||||
|
fi
|
||||||
|
done < .env
|
||||||
|
|
||||||
|
# Build Flutter web
|
||||||
|
eval flutter build web "$ARGS"
|
||||||
|
|
||||||
|
# If --preview flag is provided, run a local preview server
|
||||||
|
if [ "$1" == "--preview" ]; then
|
||||||
|
echo "Starting preview server at http://localhost:3000..."
|
||||||
|
cd build/web || exit 1
|
||||||
|
python3 -m http.server 3000
|
||||||
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user