From 226ac67d26724a117acc928f28c267d0ac0dc278 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Tue, 21 Nov 2023 13:40:17 +0000 Subject: [PATCH] Fix build --- scripts/build-frontend.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/build-frontend.py b/scripts/build-frontend.py index 4bd0d43..769f73a 100644 --- a/scripts/build-frontend.py +++ b/scripts/build-frontend.py @@ -1,4 +1,5 @@ # noqa: INP001 +import os import shutil import subprocess @@ -17,6 +18,10 @@ class CustomBuildHook(BuildHookInterface): raise RuntimeError( "NodeJS `npm` is required for building Cista but it was not found" ) - frontend = "frontend" - subprocess.run([npm, "install", "--prefix", frontend], check=True) # noqa: S603 - subprocess.run([npm, "run", "build", "--prefix", frontend], check=True) # noqa: S603 + # npm --prefix doesn't work on Windows, so we chdir instead + os.chdir("frontend") + try: + subprocess.run([npm, "install"], check=True) # noqa: S603 + subprocess.run([npm, "run", "build"], check=True) # noqa: S603 + finally: + os.chdir("..")