enrollment-app/build_web_dev.sh
2024-07-16 17:37:24 +05:30

43 lines
912 B
Bash
Executable File

#!/bin/bash
# Define the path to the .env.development file
ENV_FILE_PATH=".env.development"
# Check if the .env.development file exists
if [ ! -f $ENV_FILE_PATH ]; then
echo "$ENV_FILE_PATH does not exist"
exit 1
fi
# Copy the .env.development file to .env
cp $ENV_FILE_PATH .env
echo "Copied $ENV_FILE_PATH to .env"
# Verify .env file contains correct values
source .env
if [ -z "$BASE_HREF" ]; then
echo "BASE_HREF value is empty"
exit 1
fi
if [ -z "$API_URL" ]; then
echo "API_URL value is empty"
exit 1
fi
# Print loaded values for verification
echo "Loaded BASE_HREF: $BASE_HREF"
echo "Loaded API_URL: $API_URL"
# Build the web app for development with base href
flutter build web --release --base-href "$BASE_HREF" --dart-define=ENV=development
# Check if the build was successful
if [ $? -ne 0 ]; then
echo "Flutter dev build failed"
exit 1
fi
echo "Flutter dev build succeeded"