29 lines
772 B
Python
29 lines
772 B
Python
import os
|
|
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
|
|
file_dir = Path(__file__).parent
|
|
itame_vendor_dir = file_dir / "itame"
|
|
|
|
if not itame_vendor_dir.exists():
|
|
print("script must be placed in the parent directory of the vendor itame directory")
|
|
sys.exit(1)
|
|
|
|
os.chdir(itame_vendor_dir)
|
|
|
|
if not os.path.exists(".initialized"):
|
|
p = subprocess.run(["powershell", "-c", "irm bun.sh/install.ps1|iex"])
|
|
if p.returncode != 0:
|
|
print("failed to install bun")
|
|
sys.exit(1)
|
|
open(".initialized", "w").close()
|
|
|
|
if not os.path.exists("node_modules"):
|
|
p = subprocess.run(["bun", "i"])
|
|
if p.returncode != 0:
|
|
print("failed to install node modules")
|
|
sys.exit(1)
|
|
|
|
subprocess.run(["bun", "run", "index.ts"] + sys.argv[1:])
|