···11+#!/bin/bash
22+33+# Source both setup scripts
44+source ./scripts/setup-postgres.sh
55+source ./scripts/setup-redis.sh
66+77+# Function to handle cleanup for both services
88+cleanup_and_exit() {
99+ echo "Cleaning up services..."
1010+ cleanup_postgres
1111+ cleanup_redis
1212+ exit 0
1313+}
1414+1515+# Trap SIGINT and SIGTERM to cleanup on exit
1616+trap cleanup_and_exit SIGINT SIGTERM
1717+1818+# Run both services with concurrently
1919+concurrently -k -n APP,WORKER -c blue,green \
2020+ "dotenv -e .env.local -- concurrently -k -n TYPE,APP -c red,blue \"tsc --noEmit --watch\" \"tsup --watch --onSuccess='node dist/index.js'\"" \
2121+ "dotenv -e .env.local -- concurrently -k -n WORKER -c green \"tsup --watch --onSuccess='node dist/workers/feed-worker.js'\""
2222+2323+# Cleanup after concurrently exits
2424+cleanup_postgres
2525+cleanup_redis
+15-10
scripts/dev-feed-worker.sh
···33# Source the Redis setup script
44source ./scripts/setup-redis.sh
5566-# Function to handle cleanup
77-cleanup_and_exit() {
88- echo "Cleaning up Redis..."
99- cleanup_redis
1010- exit 0
1111-}
66+# Only setup cleanup if not running from combined script
77+if [ -z "$COMBINED_SCRIPT" ]; then
88+ # Function to handle cleanup
99+ cleanup_and_exit() {
1010+ echo "Cleaning up Redis..."
1111+ cleanup_redis
1212+ exit 0
1313+ }
12141313-# Trap SIGINT and SIGTERM to cleanup on exit
1414-trap cleanup_and_exit SIGINT SIGTERM
1515+ # Trap SIGINT and SIGTERM to cleanup on exit
1616+ trap cleanup_and_exit SIGINT SIGTERM
1717+fi
15181619# Run the feed worker dev command
1720npm run dev:worker:feeds:inner
18211919-# Cleanup after dev command exits
2020-cleanup_redis
2222+# Only cleanup if not running from combined script
2323+if [ -z "$COMBINED_SCRIPT" ]; then
2424+ cleanup_redis
2525+fi
+15-10
scripts/dev.sh
···33# Source the Postgres setup script
44source ./scripts/setup-postgres.sh
5566-# Function to handle cleanup
77-cleanup_and_exit() {
88- echo "Cleaning up Postgres..."
99- cleanup_postgres
1010- exit 0
1111-}
66+# Only setup cleanup if not running from combined script
77+if [ -z "$COMBINED_SCRIPT" ]; then
88+ # Function to handle cleanup
99+ cleanup_and_exit() {
1010+ echo "Cleaning up Postgres..."
1111+ cleanup_postgres
1212+ exit 0
1313+ }
12141313-# Trap SIGINT and SIGTERM to cleanup on exit
1414-trap cleanup_and_exit SIGINT SIGTERM
1515+ # Trap SIGINT and SIGTERM to cleanup on exit
1616+ trap cleanup_and_exit SIGINT SIGTERM
1717+fi
15181619# Run the dev command
1720npm run dev:app:inner
18211919-# Cleanup after dev command exits
2020-cleanup_postgres
2222+# Only cleanup if not running from combined script
2323+if [ -z "$COMBINED_SCRIPT" ]; then
2424+ cleanup_postgres
2525+fi