2022-07-24 07:26:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
ENV=${1:-dev}
|
|
|
|
case $ENV in
|
|
|
|
dev)
|
|
|
|
FIREBASE_PROJECT=dev
|
2022-07-24 09:30:28 +00:00
|
|
|
NEXT_ENV=DEV ;;
|
2022-07-24 07:26:38 +00:00
|
|
|
prod)
|
|
|
|
FIREBASE_PROJECT=prod
|
2022-07-24 09:30:28 +00:00
|
|
|
NEXT_ENV=PROD ;;
|
2022-07-24 07:26:38 +00:00
|
|
|
localdb)
|
|
|
|
FIREBASE_PROJECT=dev
|
|
|
|
NEXT_ENV=DEV
|
|
|
|
EMULATOR=true ;;
|
|
|
|
*)
|
|
|
|
echo "Invalid environment; must be dev, prod, or localdb."
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
firebase use $FIREBASE_PROJECT
|
|
|
|
|
|
|
|
if [ ! -z $EMULATOR ]
|
|
|
|
then
|
|
|
|
npx concurrently \
|
|
|
|
-n FIRESTORE,FUNCTIONS,NEXT,TS \
|
|
|
|
-c green,white,magenta,cyan \
|
2022-08-24 16:49:53 +00:00
|
|
|
"yarn --cwd=functions localDbScript" \
|
2022-07-24 07:26:38 +00:00
|
|
|
"cross-env FIRESTORE_EMULATOR_HOST=localhost:8080 yarn --cwd=functions dev" \
|
|
|
|
"cross-env NEXT_PUBLIC_FUNCTIONS_URL=http://localhost:8088 \
|
|
|
|
NEXT_PUBLIC_FIREBASE_EMULATE=TRUE \
|
|
|
|
NEXT_PUBLIC_FIREBASE_ENV=${NEXT_ENV} \
|
|
|
|
yarn --cwd=web serve" \
|
|
|
|
"cross-env yarn --cwd=web ts-watch"
|
|
|
|
else
|
|
|
|
npx concurrently \
|
|
|
|
-n FUNCTIONS,NEXT,TS \
|
|
|
|
-c white,magenta,cyan \
|
|
|
|
"yarn --cwd=functions dev" \
|
|
|
|
"cross-env NEXT_PUBLIC_FUNCTIONS_URL=http://localhost:8088 \
|
|
|
|
NEXT_PUBLIC_FIREBASE_ENV=${NEXT_ENV} \
|
|
|
|
yarn --cwd=web serve" \
|
|
|
|
"cross-env yarn --cwd=web ts-watch"
|
|
|
|
fi
|