Fix build
This commit is contained in:
parent
226ac67d26
commit
7ff57924ae
|
@ -2,6 +2,7 @@
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from sys import stderr
|
||||||
|
|
||||||
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
||||||
|
|
||||||
|
@ -12,7 +13,7 @@ class CustomBuildHook(BuildHookInterface):
|
||||||
# A hack to stop building twice on run
|
# A hack to stop building twice on run
|
||||||
if not build_data.get("force_include"):
|
if not build_data.get("force_include"):
|
||||||
return
|
return
|
||||||
print("Building Cista frontend...", version, build_data)
|
stderr.write("🏗️ Building Cista frontend\n")
|
||||||
npm = shutil.which("npm")
|
npm = shutil.which("npm")
|
||||||
if npm is None:
|
if npm is None:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
|
@ -21,7 +22,9 @@ class CustomBuildHook(BuildHookInterface):
|
||||||
# npm --prefix doesn't work on Windows, so we chdir instead
|
# npm --prefix doesn't work on Windows, so we chdir instead
|
||||||
os.chdir("frontend")
|
os.chdir("frontend")
|
||||||
try:
|
try:
|
||||||
|
stderr.write(" 》npm install\n")
|
||||||
subprocess.run([npm, "install"], check=True) # noqa: S603
|
subprocess.run([npm, "install"], check=True) # noqa: S603
|
||||||
|
stderr.write("\n 》npm run build\n")
|
||||||
subprocess.run([npm, "run", "build"], check=True) # noqa: S603
|
subprocess.run([npm, "run", "build"], check=True) # noqa: S603
|
||||||
finally:
|
finally:
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user