-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_dev.sh
More file actions
executable file
·67 lines (57 loc) · 2.43 KB
/
Copy pathsetup_dev.sh
File metadata and controls
executable file
·67 lines (57 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
# setup_dev.sh
# MapToPoster Developer Setup Script
set -e
# Color helpers
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${BLUE}==================================================${NC}"
echo -e "${GREEN} MapToPoster Development Setup Guide ${NC}"
echo -e "${BLUE}==================================================${NC}"
# Check for uv
if ! command -v uv &> /dev/null; then
echo -e "${RED}Error: 'uv' is not installed.${NC}"
echo -e "Please install uv (https://docs.astral.sh/uv/) first."
echo -e "On macOS, you can run: ${YELLOW}brew install uv${NC}"
exit 1
fi
# Check for npm
if ! command -v npm &> /dev/null; then
echo -e "${RED}Error: 'npm' is not installed.${NC}"
echo -e "Please install Node.js (which includes npm)."
echo -e "On macOS, you can run: ${YELLOW}brew install node${NC}"
exit 1
fi
# 1. Setup Python environment
echo -e "\n${BLUE}[1/3] Syncing Python virtual environment & dependencies...${NC}"
uv sync --locked
echo -e "${GREEN}✓ Python dependencies synced successfully.${NC}"
# 2. Setup Backend env file
echo -e "\n${BLUE}[2/3] Setting up environment files...${NC}"
if [ ! -f web/backend/.env ]; then
echo -e "Creating web/backend/.env from .env.example..."
cp web/backend/.env.example web/backend/.env
# Adjust ALLOWED_ORIGINS to default local development port
sed -i.bak 's|https://maptoposter.vercel.app,http://localhost:3000|http://localhost:3000|g' web/backend/.env && rm web/backend/.env.bak || true
else
echo -e "web/backend/.env already exists. Skipping."
fi
if [ ! -f web/frontend/.env.local ]; then
echo -e "Creating web/frontend/.env.local..."
echo -e "BACKEND_URL=http://localhost:8000\nNEXT_PUBLIC_SITE_URL=http://localhost:3000" > web/frontend/.env.local
else
echo -e "web/frontend/.env.local already exists. Skipping."
fi
echo -e "${GREEN}✓ Environment files configured.${NC}"
# 3. Setup Frontend dependencies
echo -e "\n${BLUE}[3/3] Installing Next.js frontend dependencies...${NC}"
cd web/frontend
npm install
echo -e "${GREEN}✓ Frontend dependencies installed successfully.${NC}"
echo -e "\n${BLUE}==================================================${NC}"
echo -e "${GREEN}✓ Setup complete! You are ready to start. ${NC}"
echo -e "Run ${YELLOW}./start_dev.sh${NC} to start the backend and frontend."
echo -e "${BLUE}==================================================${NC}"