remove bash -lc

This commit is contained in:
Mateusz Gruszczyński
2025-10-24 09:36:03 +02:00
parent 611de3d79d
commit a9c74351ee

View File

@@ -584,15 +584,33 @@ def install_node_and_yarn(node_pkg: str):
os.symlink("/usr/bin/yarnpkg","/usr/bin/yarn")
def _build_frontend(src_frontend: Path, dest_frontend: Path):
def _which(cmd: str) -> bool:
import shutil as _s
return _s.which(cmd) is not None
yarn = "yarn" if _which("yarn") else ("yarnpkg" if _which("yarnpkg") else "")
if not yarn:
run(["corepack", "enable"], check=False)
run(["corepack", "prepare", "yarn@stable", "--activate"], check=False)
yarn = "yarn" if _which("yarn") else ("yarnpkg" if _which("yarnpkg") else "")
if not yarn:
raise RuntimeError("Brak Yarn. Zainstaluj: npm i -g yarn (lub użyj corepack).")
with step("Installing frontend dependencies (yarn)"):
os.environ["NODE_ENV"] = "development"
os.chdir(src_frontend)
run(["yarn", "cache", "clean", "--all"])
run(["yarn", "install"])
cache_dir = (run_out([yarn, "cache", "dir"], check=False) or "").strip()
if cache_dir and not Path(cache_dir).exists():
Path(cache_dir).mkdir(parents=True, exist_ok=True)
run([yarn, "cache", "clean"], check=False)
run([yarn, "install"])
with step("Building frontend (yarn build)"):
env = os.environ.copy()
env["NODE_OPTIONS"] = "--openssl-legacy-provider"
run(["yarn", "build"], env=env)
run([yarn, "build"], env=env)
with step("Copying frontend artifacts"):
shutil.copytree(src_frontend / "dist", dest_frontend, dirs_exist_ok=True)
if (src_frontend / "app-images").exists():