-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrestart_frontend.py
More file actions
58 lines (47 loc) · 1.54 KB
/
Copy pathrestart_frontend.py
File metadata and controls
58 lines (47 loc) · 1.54 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
#!/usr/bin/env python3
"""
Quick script to restart just the frontend with fixed Tailwind config
"""
import subprocess
import sys
import time
import os
import signal
def kill_frontend():
"""Kill any running frontend processes"""
try:
result = subprocess.run(['lsof', '-ti', ':3000'], capture_output=True, text=True)
if result.stdout.strip():
pids = result.stdout.strip().split('\n')
for pid in pids:
subprocess.run(['kill', '-9', pid], capture_output=True)
print("✅ Stopped existing frontend")
except Exception as e:
print(f"⚠️ Could not clean frontend: {e}")
def main():
print("🔧 Restarting Frontend with Fixed Tailwind Config")
print("=" * 50)
# Stop any existing frontend
kill_frontend()
time.sleep(2)
# Start frontend
print("🎨 Starting frontend on http://localhost:3000...")
os.chdir('frontend')
try:
# Start the frontend process
process = subprocess.Popen(['npm', 'run', 'dev'])
print("✅ Frontend restarted!")
print("🌐 Visit: http://localhost:3000")
print("🛑 Press Ctrl+C to stop")
# Wait for process or Ctrl+C
process.wait()
except KeyboardInterrupt:
print("\n🛑 Stopping frontend...")
process.terminate()
try:
process.wait(timeout=5)
except subprocess.TimeoutExpired:
process.kill()
print("✅ Frontend stopped")
if __name__ == "__main__":
main()