-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart-dev.ps1
More file actions
89 lines (75 loc) · 2.83 KB
/
Copy pathstart-dev.ps1
File metadata and controls
89 lines (75 loc) · 2.83 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# HackThe6ix2025 Development Startup Script
# This script starts both the backend Flask server and frontend React development server
Write-Host "Starting development environment..." -ForegroundColor Green
# Check if we're in the correct directory
if (-not (Test-Path "backend") -or -not (Test-Path "frontend")) {
Write-Host "Error: Please run this script from the project root directory" -ForegroundColor Red
exit 1
}
# Function to check if a command exists
function Test-Command($cmdname) {
return [bool](Get-Command -Name $cmdname -ErrorAction SilentlyContinue)
}
# Check prerequisites
if (-not (Test-Command "python")) {
Write-Host "Error: Python is not installed or not in PATH" -ForegroundColor Red
exit 1
}
if (-not (Test-Command "node")) {
Write-Host "Error: Node.js is not installed or not in PATH" -ForegroundColor Red
exit 1
}
if (-not (Test-Command "npm")) {
Write-Host "Error: npm is not installed or not in PATH" -ForegroundColor Red
exit 1
}
# Setup virtual environment
$venvPath = "backend\.venv"
if (-not (Test-Path $venvPath)) {
Write-Host "Creating virtual environment..." -ForegroundColor Yellow
Set-Location backend
python -m venv .venv
Set-Location ..
}
# Install Python dependencies
Write-Host "Installing Python dependencies..." -ForegroundColor Yellow
Set-Location backend
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
Set-Location ..
# Install Node dependencies
if (-not (Test-Path "frontend\node_modules")) {
Write-Host "Installing Node dependencies..." -ForegroundColor Yellow
Set-Location frontend
npm install
Set-Location ..
}
Write-Host "Starting backend server..." -ForegroundColor Cyan
# Start backend in a new window
Start-Process powershell -ArgumentList @(
"-NoExit",
"-Command",
"Write-Host 'Starting Flask backend...' -ForegroundColor Cyan; " +
"Set-Location '$PWD\backend'; " +
"if (Test-Path '.\.venv\Scripts\python.exe') { " +
" Write-Host 'Using virtual environment Python...' -ForegroundColor Green; " +
" .\.venv\Scripts\python.exe -m pip install -r requirements.txt; " +
" .\.venv\Scripts\python.exe run.py " +
"} else { " +
" Write-Host 'Virtual environment not found!' -ForegroundColor Red; " +
" pause " +
"}"
) -WindowStyle Normal
Write-Host "Starting frontend server..." -ForegroundColor Cyan
# Start frontend in a new window
Start-Process powershell -ArgumentList @(
"-NoExit",
"-Command",
"Write-Host 'Starting React frontend...' -ForegroundColor Cyan; " +
"Set-Location '$PWD\frontend'; " +
"npm install; " +
"npm start"
) -WindowStyle Normal
Write-Host ""
Write-Host "Development environment starting..." -ForegroundColor Green
Write-Host "Backend: http://localhost:5000" -ForegroundColor Gray
Write-Host "Frontend: http://localhost:3000" -ForegroundColor Gray