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
7 changes: 6 additions & 1 deletion preswald/build.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
"""Build utilities for preswald."""

import os
import shutil
import subprocess
import sys
from pathlib import Path


env = os.environ.copy()
env["NODE_OPTIONS"] = env.get("NODE_OPTIONS", "--max-old-space-size=4096")


def _run_npm_command(cmd: str, cwd: Path) -> int:
"""Run an npm command in the specified directory."""
npm_path = shutil.which("npm")
if not npm_path:
print("Error: npm not found. Please install npm first.", file=sys.stderr)
return 1

result = subprocess.run([npm_path, *cmd.split()], cwd=cwd, check=False)
result = subprocess.run([npm_path, *cmd.split()], cwd=cwd, check=False, env=env)
return result.returncode


Expand Down