2025-05-07 09:47:03 +08:00

36 lines
926 B
Bash
Executable File

#!/bin/bash
# Define colors
RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Required Node.js version
REQUIRED_NODE_VERSION="v22.15.0"
# Check Node.js version
NODE_VERSION=$(node -v 2>/dev/null)
if [ "$NODE_VERSION" != "$REQUIRED_NODE_VERSION" ]; then
echo -e "${YELLOW}Warning:${NC} Node.js version is $NODE_VERSION, but required is $REQUIRED_NODE_VERSION."
else
echo -e "${GREEN}Node.js version is correct: $NODE_VERSION${NC}"
fi
# Start the frontend dev server from anywhere in the repo
cd "$(dirname "$0")/../frontend" || exit 1
# Install dependencies
if [ -f package.json ]; then
echo -e "${BLUE}Installing dependencies...${NC}"
npm install
echo -e "${GREEN}Dependencies installed.${NC}"
else
echo -e "${RED}Error:${NC} package.json not found in frontend directory!"
exit 1
fi
# Run dev server
echo -e "${BLUE}Starting dev server...${NC}"
npm run dev