-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrundev.py
More file actions
executable file
·31 lines (27 loc) · 838 Bytes
/
Copy pathrundev.py
File metadata and controls
executable file
·31 lines (27 loc) · 838 Bytes
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
#!/usr/bin/env python3
from subprocess import Popen
import os
def determine_port():
if not os.path.exists('.env'):
return None
with open('.env', 'r') as file:
for line in map(lambda e: e.strip(), file):
if not line or '=' not in line: continue
key, value = line.split('=')
if key == 'PORT': return value
return None
commands = [
'nodemon --ext "go" --exec "go run ." --signal SIGTERM',
'sass --watch --no-source-map styles:assets',
'nodemon --ext "ts" --watch client --exec "tsc"',
]
port = determine_port()
if port:
host = f'http://localhost{port}'
open_command = 'sleep 2 && ' + (f'open {host}' if os.name == 'posix' else f'start {host}')
commands.append(open_command)
processes = [Popen(c, shell=True) for c in commands]
try:
for proc in processes: proc.wait()
except:
print('Done')