Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions build_scripts/prepare_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ def build_frontend(frontend_dir: Path) -> bool:
print("Building TypeScript/React frontend...")
print("=" * 60)

# Check if npm is available
# Check if npm is available (with cross-platform compatibility)
npm = shutil.which("npm")
try:
result = subprocess.run(["npm", "--version"], capture_output=True, text=True, check=True)
if npm is None:
raise FileNotFoundError("npm not found")
result = subprocess.run([npm, "--version"], capture_output=True, text=True, check=True)
print(f"Found npm version: {result.stdout.strip()}")
except (subprocess.CalledProcessError, FileNotFoundError):
print("ERROR: npm is not installed or not in PATH")
Expand All @@ -45,7 +48,7 @@ def build_frontend(frontend_dir: Path) -> bool:
print("\nInstalling frontend dependencies...")
try:
subprocess.run(
["npm", "install"],
[npm, "install"],
cwd=frontend_dir,
check=True,
stdout=subprocess.PIPE,
Expand All @@ -61,7 +64,7 @@ def build_frontend(frontend_dir: Path) -> bool:
print("\nBuilding frontend for production...")
try:
subprocess.run(
["npm", "run", "build"],
[npm, "run", "build"],
cwd=frontend_dir,
check=True,
stdout=subprocess.PIPE,
Expand Down
Loading