remove bash -lc

This commit is contained in:
Mateusz Gruszczyński
2025-10-24 09:38:46 +02:00
parent a9c74351ee
commit 09f7b84d61

View File

@@ -588,13 +588,24 @@ def _build_frontend(src_frontend: Path, dest_frontend: Path):
import shutil as _s
return _s.which(cmd) is not None
yarn = "yarn" if _which("yarn") else ("yarnpkg" if _which("yarnpkg") else "")
def _good_yarn(cmd: str) -> bool:
out = (run_out([cmd, "--version"], check=False) or "").strip()
return bool(re.match(r"^\d+(?:\.\d+){1,3}$", out))
yarn = None
for cand in ("yarn", "yarnpkg"):
if _which(cand) and _good_yarn(cand):
yarn = cand
break
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 "")
for cand in ("yarn", "yarnpkg"):
if _which(cand) and _good_yarn(cand):
yarn = cand
break
if not yarn:
raise RuntimeError("Brak Yarn. Zainstaluj: npm i -g yarn (lub użyj corepack).")
raise RuntimeError("No yarn in system")
with step("Installing frontend dependencies (yarn)"):
os.environ["NODE_ENV"] = "development"
@@ -602,8 +613,8 @@ def _build_frontend(src_frontend: Path, dest_frontend: Path):
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, "cache", "clean"], check=False)
run([yarn, "install"])
with step("Building frontend (yarn build)"):