chore: improve DX scripts, fix test suite, and harden tooling

Scripts:
- remote.sh: remove unused open_browser() function
- deploy-remote.sh: add DB backup before deploy, --skip-backup flag, step numbering
- db-backup.sh: fix macOS compat (xargs -r is GNU-only), use portable approach
- db-restore.sh: add safety backup before restore, SQL file validation, file size display
- logs.sh: default to no-follow with --tail=100, order-independent arg parsing
- docker-cleanup.sh: add Docker health check, colored output
- test-sequential.sh: exclude *.integration.test.ts by default, add --integration flag
- simulate-ci.sh: pass --integration flag (has real DB)

Tests:
- db.test.ts: fix mock path from ./DrizzleClient to @shared/db/DrizzleClient
- server.settings.test.ts: rewrite mocks for gameSettingsService (old config/saveConfig removed)
- server.test.ts: add missing config.lootdrop and BotClient mocks, complete DrizzleClient chain
- indexes.test.ts: rename to indexes.integration.test.ts (requires live DB)

Config:
- package.json: test script uses sequential runner, add test:ci and db:restore aliases
- deploy.yml: use --integration flag in CI (has Postgres service)
This commit is contained in:
syntaxbullet
2026-02-13 14:39:02 +01:00
parent f822d90dd3
commit aca5538d57
16 changed files with 263 additions and 119 deletions

View File

@@ -1,14 +1,31 @@
#!/bin/bash
# Cleanup script for Docker resources
# Use: ./shared/scripts/docker-cleanup.sh
# Use: ./shared/scripts/docker-cleanup.sh --full (for aggressive cleanup)
# =============================================================================
# Aurora Docker Cleanup Script
# =============================================================================
# Cleans up Docker resources to free disk space.
#
# Usage: ./docker-cleanup.sh (interactive mode)
# ./docker-cleanup.sh --full (automatic full cleanup)
# =============================================================================
set -e
echo "🧹 Aurora Docker Cleanup"
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${YELLOW}🧹 Aurora Docker Cleanup${NC}"
echo "========================"
echo ""
# Verify Docker is running
if ! docker info > /dev/null 2>&1; then
echo -e "${RED}Error: Docker is not running.${NC}"
exit 1
fi
# Show current disk usage first
echo "📊 Current Docker disk usage:"
docker system df
@@ -26,7 +43,7 @@ docker image prune -f
# Check for --full flag for aggressive cleanup
if [[ "$1" == "--full" ]]; then
echo ""
echo "🔥 Full cleanup mode - removing all unused Docker resources..."
echo -e "${YELLOW}🔥 Full cleanup mode - removing all unused Docker resources...${NC}"
# Remove all unused images, not just dangling ones
echo " → Removing unused images..."
@@ -49,7 +66,7 @@ if [[ "$1" == "--full" ]]; then
docker volume rm aurora_app_node_modules aurora_web_node_modules 2>/dev/null || true
echo ""
echo "✅ Full cleanup complete!"
echo -e "${GREEN}✅ Full cleanup complete!${NC}"
else
# Interactive mode
echo ""
@@ -57,7 +74,7 @@ else
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
docker builder prune -f
echo "✓ Build cache cleared"
echo -e "${GREEN}${NC} Build cache cleared"
fi
echo ""
@@ -65,7 +82,7 @@ else
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
docker image prune -a -f
echo "✓ Unused images removed"
echo -e "${GREEN}${NC} Unused images removed"
fi
echo ""
@@ -73,7 +90,7 @@ else
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
docker volume rm aurora_app_node_modules aurora_web_node_modules 2>/dev/null || true
echo "✓ Node modules volumes removed"
echo -e "${GREEN}${NC} Node modules volumes removed"
fi
echo ""
@@ -81,11 +98,11 @@ else
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
docker system prune -a -f --volumes
echo "✓ Full system prune complete"
echo -e "${GREEN}${NC} Full system prune complete"
fi
echo ""
echo "✅ Cleanup complete!"
echo -e "${GREEN}✅ Cleanup complete!${NC}"
fi
echo ""