From ddbfc3342db5559cb2eee65fc18546334ef3b8b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Dubut?= <13616428+fdubut@users.noreply.github.com> Date: Mon, 6 Apr 2026 09:22:42 -0700 Subject: [PATCH] Add Windows compat to build script --- build_scripts/prepare_package.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build_scripts/prepare_package.py b/build_scripts/prepare_package.py index 8e999c8129..21ba6ca445 100644 --- a/build_scripts/prepare_package.py +++ b/build_scripts/prepare_package.py @@ -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") @@ -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, @@ -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,