-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_project.py
More file actions
28 lines (24 loc) · 857 Bytes
/
init_project.py
File metadata and controls
28 lines (24 loc) · 857 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
import os
import subprocess
import sys
def run_command(command, cwd=None):
try:
# Explicitly use bash to avoid fish syntax issues in the shell wrapper if possible,
# otherwise run directly.
subprocess.run(command, cwd=cwd, check=True, shell=True, executable='/bin/bash')
print(f"Successfully ran: {command}")
except subprocess.CalledProcessError as e:
print(f"Error running {command}: {e}")
except Exception as e:
print(f"Execution failed: {e}")
def create_dirs():
os.makedirs('src/backend', exist_ok=True)
os.makedirs('src/tui', exist_ok=True)
print("Directories created.")
def install_node_deps():
# Attempt to install node modules
if os.path.exists('package.json'):
run_command('npm install')
if __name__ == "__main__":
create_dirs()
install_node_deps()