Files
explorer-monorepo/scripts/check-requirements.sh

70 lines
1.7 KiB
Bash
Raw Normal View History

#!/bin/bash
# Check requirements for running the platform
# Get script directory and project root
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )"
cd "$PROJECT_ROOT"
echo "Checking requirements..."
ERRORS=0
# Check Go
if ! command -v go &> /dev/null; then
echo "❌ Go is not installed"
ERRORS=$((ERRORS + 1))
else
GO_VERSION=$(go version | awk '{print $3}')
echo "✅ Go installed: $GO_VERSION"
fi
# Check Node.js
if ! command -v node &> /dev/null; then
echo "❌ Node.js is not installed"
ERRORS=$((ERRORS + 1))
else
NODE_VERSION=$(node --version)
echo "✅ Node.js installed: $NODE_VERSION"
fi
# Check Docker
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed"
ERRORS=$((ERRORS + 1))
else
DOCKER_VERSION=$(docker --version)
echo "✅ Docker installed: $DOCKER_VERSION"
fi
# Check Docker Compose
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
echo "❌ Docker Compose is not installed"
ERRORS=$((ERRORS + 1))
else
echo "✅ Docker Compose installed"
fi
# Check if we're in the right directory
if [ ! -f "$PROJECT_ROOT/backend/go.mod" ] || [ ! -f "$PROJECT_ROOT/frontend/package.json" ]; then
echo "❌ Not in the project root directory"
echo " Please run this script from the explorer-monorepo directory"
echo " Current directory: $PROJECT_ROOT"
ERRORS=$((ERRORS + 1))
else
echo "✅ In project root directory: $PROJECT_ROOT"
fi
if [ $ERRORS -eq 0 ]; then
echo ""
echo "✅ All requirements met!"
exit 0
else
echo ""
echo "$ERRORS requirement(s) missing"
exit 1
fi