Files
solace-bg-dubai/scripts/check-setup.sh
defiQUG c94eb595f8
Some checks failed
CI / lint-and-test (push) Has been cancelled
Initial commit: add .gitignore and README
2026-02-09 21:51:53 -08:00

103 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
# Setup verification script
# Checks if all required dependencies and configurations are in place
set -e
echo "🔍 Checking Solace Treasury DApp setup..."
echo ""
# Check Node.js
if command -v node &> /dev/null; then
NODE_VERSION=$(node --version)
echo "✅ Node.js: $NODE_VERSION"
else
echo "❌ Node.js not found. Please install Node.js >= 18.0.0"
exit 1
fi
# Check pnpm
if command -v pnpm &> /dev/null; then
PNPM_VERSION=$(pnpm --version)
echo "✅ pnpm: $PNPM_VERSION"
else
echo "❌ pnpm not found. Install with: npm install -g pnpm"
exit 1
fi
# Check PostgreSQL
if command -v psql &> /dev/null; then
echo "✅ PostgreSQL: $(psql --version | head -n1)"
else
echo "⚠️ PostgreSQL not found (required for database)"
fi
# Check if dependencies are installed
if [ -d "node_modules" ]; then
echo "✅ Dependencies installed"
else
echo "❌ Dependencies not installed. Run: pnpm install"
exit 1
fi
# Check contracts compilation
if [ -d "contracts/artifacts" ]; then
echo "✅ Contracts compiled"
else
echo "⚠️ Contracts not compiled. Run: cd contracts && pnpm run compile"
fi
# Check environment files
echo ""
echo "📋 Environment files:"
if [ -f "frontend/.env.local" ] || [ -f "frontend/.env" ]; then
echo "✅ Frontend env file exists"
else
echo "⚠️ Frontend .env.local not found (create from template)"
fi
if [ -f "backend/.env" ]; then
echo "✅ Backend env file exists"
else
echo "⚠️ Backend .env not found (create from template)"
fi
if [ -f "contracts/.env" ]; then
echo "✅ Contracts env file exists"
else
echo "⚠️ Contracts .env not found (create from template)"
fi
# Check database migrations
if [ -d "backend/drizzle" ] && [ "$(ls -A backend/drizzle/*.sql 2>/dev/null)" ]; then
echo "✅ Database migrations generated"
else
echo "⚠️ Database migrations not generated. Run: cd backend && pnpm run db:generate"
fi
# Check if database is accessible (if DATABASE_URL is set)
if [ -f "backend/.env" ]; then
source backend/.env
if [ -n "$DATABASE_URL" ]; then
if command -v psql &> /dev/null; then
if psql "$DATABASE_URL" -c "SELECT 1;" &> /dev/null; then
echo "✅ Database connection successful"
else
echo "⚠️ Database connection failed (check DATABASE_URL)"
fi
fi
fi
fi
echo ""
echo "✨ Setup check complete!"
echo ""
echo "Next steps:"
echo "1. Create .env files if missing"
echo "2. Set up database: cd backend && pnpm run db:migrate"
echo "3. Deploy contracts: cd contracts && pnpm run deploy:sepolia"
echo "4. Start dev servers: pnpm run dev"