This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

update dev script to handle docker container

+37 -1
+2 -1
package.json
··· 12 12 "test:e2e": "jest src/modules/user/tests/e2e/OAuthSignInFlow.test.ts --testTimeout=300000", 13 13 "build": "tsup", 14 14 "build:watch": "tsc --watch", 15 - "dev": "dotenv -e .env.local -- concurrently -k -n TYPE,CODE -c red,blue \"tsc --noEmit --watch\" \"tsup --watch --onSuccess='node dist/index.js'\"", 15 + "dev:inner": "dotenv -e .env.local -- concurrently -k -n TYPE,CODE -c red,blue \"tsc --noEmit --watch\" \"tsup --watch --onSuccess='node dist/index.js'\"", 16 + "dev": "bash ./scripts/dev.sh", 16 17 "migrate": "node dist/scripts/migrate.js", 17 18 "lexgen": "lex gen-server ./src/modules/atproto/infrastructure/lexicon ./src/modules/atproto/infrastructure/lexicons/*", 18 19 "db:start": "docker run --name annos-postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=annotations -p 5432:5432 -d postgres:14",
+35
scripts/dev.sh
··· 1 + #!/bin/bash 2 + 3 + # Check if Docker daemon is running 4 + if ! docker info > /dev/null 2>&1; then 5 + echo "Error: Docker daemon is not running. Please start Docker and try again." 6 + exit 1 7 + fi 8 + 9 + # Check if the container is running 10 + if [ "$(docker ps -q -f name=annos-postgres)" ]; then 11 + echo "Postgres container is already running." 12 + DB_RUNNING=true 13 + else 14 + echo "Starting Postgres container..." 15 + npm run db:start 16 + DB_RUNNING=false 17 + fi 18 + 19 + # Trap SIGINT and SIGTERM to stop the DB on exit, only if we started it 20 + function cleanup { 21 + if [ "$DB_RUNNING" = false ]; then 22 + if [ "$(docker ps -q -f name=annos-postgres)" ]; then 23 + echo "Stopping Postgres container..." 24 + npm run db:stop 25 + npm run db:remove 26 + fi 27 + fi 28 + } 29 + trap cleanup SIGINT SIGTERM 30 + 31 + # Run the dev command 32 + npm run dev:inner 33 + 34 + # Cleanup after dev command exits 35 + cleanup