Start the frontend dev server
(frontend_dir: Path)
| 258 | |
| 259 | |
| 260 | def start_frontend(frontend_dir: Path): |
| 261 | """Start the frontend dev server""" |
| 262 | global _frontend_process |
| 263 | |
| 264 | print("🎨 Starting frontend server...") |
| 265 | |
| 266 | npm_cmd = "npm.cmd" if get_platform() == "windows" else "npm" |
| 267 | |
| 268 | if get_platform() == "windows": |
| 269 | _frontend_process = subprocess.Popen( |
| 270 | f"{npm_cmd} run dev", |
| 271 | cwd=frontend_dir, |
| 272 | shell=True, |
| 273 | creationflags=subprocess.CREATE_NEW_PROCESS_GROUP, |
| 274 | ) |
| 275 | else: |
| 276 | _frontend_process = subprocess.Popen( |
| 277 | [npm_cmd, "run", "dev"], |
| 278 | cwd=frontend_dir, |
| 279 | start_new_session=True, # Create new process group |
| 280 | ) |
| 281 | |
| 282 | # Wait for frontend to start |
| 283 | time.sleep(3) |
| 284 | |
| 285 | if _frontend_process.poll() is None: |
| 286 | print("✅ Frontend started: http://localhost:5173") |
| 287 | return True |
| 288 | else: |
| 289 | print("❌ Frontend failed to start") |
| 290 | return False |
| 291 | |
| 292 | |
| 293 | def cleanup_processes(): |