mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-02-20 07:44:01 -05:00
Clean
This commit is contained in:
@@ -17,8 +17,7 @@ check_services() {
|
||||
|
||||
if ! supabase status --output json | jq -r '.API_URL'; then
|
||||
print_error "Supabase is not running. Starting..."
|
||||
supabase start
|
||||
supabase db reset
|
||||
yarn test:db:reset
|
||||
missing=1
|
||||
fi
|
||||
|
||||
|
||||
@@ -59,12 +59,8 @@ print_status "Killing any stale processes..."
|
||||
supabase stop --no-backup 2>/dev/null || true
|
||||
sleep 2 # Give ports time to free up
|
||||
|
||||
# Start Supabase (includes Postgres, Auth, Storage, etc.)
|
||||
supabase start
|
||||
|
||||
# Apply migrations (if using Supabase migrations)
|
||||
./scripts/combine-migrations.sh
|
||||
supabase db reset
|
||||
# Start Supabase (includes Postgres, Auth, Storage, etc.) and Apply migrations
|
||||
yarn test:db:reset
|
||||
|
||||
# Get connection details
|
||||
export NEXT_PUBLIC_SUPABASE_URL=$(supabase status --output json | jq -r '.API_URL')
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$(dirname "$0")"/..
|
||||
|
||||
# Run the web app locally in full isolation (database, storage and authentication all stored locally)
|
||||
# What runs on each port?
|
||||
# - 4000: Firebase emulator UI
|
||||
@@ -17,7 +19,7 @@
|
||||
|
||||
# Clean ghost processes
|
||||
kill_ghosts() {
|
||||
for p in 3000 4000 4400 4500 8088; do
|
||||
for p in 3000 4000 4400 4500 8088 9099 9199; do
|
||||
pids=$(lsof -ti :$p 2>/dev/null)
|
||||
if [ -n "$pids" ]; then
|
||||
kill $pids || true
|
||||
@@ -30,22 +32,35 @@ set -euo pipefail
|
||||
|
||||
# Function to clean up background processes
|
||||
cleanup() {
|
||||
echo "Stopping background processes..."
|
||||
print_status "Cleaning up..."
|
||||
|
||||
# Stop Firebase emulators
|
||||
./scripts/firebase_stop.sh
|
||||
|
||||
# Kill all background processes
|
||||
for pid in "${PIDS[@]:-}"; do
|
||||
if kill -0 "$pid" 2>/dev/null; then
|
||||
kill "$pid" || true
|
||||
kill "$pid" 2>/dev/null || true
|
||||
wait "$pid" 2>/dev/null || true
|
||||
echo "Killed PID $pid"
|
||||
fi
|
||||
done
|
||||
|
||||
kill_ghosts
|
||||
|
||||
# Stop Docker containers
|
||||
if [ "${SKIP_DB_CLEANUP:-}" != "true" ]; then
|
||||
print_status "Stopping test database..."
|
||||
docker compose -f scripts/docker-compose.test.yml down -v
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
|
||||
print_status "Cleanup complete"
|
||||
}
|
||||
|
||||
# Trap EXIT, INT, TERM to run cleanup automatically
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
cd "$(dirname "$0")"/..
|
||||
|
||||
export $(cat .env.test | grep -v '^#' | xargs)
|
||||
|
||||
# Ensure Supabase local stack is running; if not, reset/start it
|
||||
|
||||
Reference in New Issue
Block a user