This commit is contained in:
onysd 2026-08-24 23:17:55 +03:00
parent 5d328e2ddf
commit f47a6584aa

View file

@ -276,21 +276,18 @@ class ServerManager:
BIN_DIR.mkdir(exist_ok=True)
log = []
# cmd/telesrv-admin embeds web/dist via go:embed -- `go build` alone
# just re-embeds whatever dist/ already happens to be on disk, so a
# frontend-only change (edit TSX, restart) silently ships the old
# bundle unless we rebuild it here first, every time.
# just re-embeds whatever dist/ already happens to be on disk. dist/
# is committed to git precisely so prod (older Node, no JS toolchain
# by design) never needs to build it; only rebuild here when
# node_modules already exists -- i.e. a dev explicitly set this up on
# a machine with a compatible Node/npm. Never auto-`npm install`:
# that's what actually invokes vite, and vite 8 requires a newer
# Node than prod ships, so an implicit install-then-build would just
# fail there instead of silently doing nothing.
admin_web_dir = ROOT / "cmd" / "telesrv-admin" / "web"
if (admin_web_dir / "package.json").exists():
if (admin_web_dir / "node_modules").exists():
npm = shutil.which("npm")
if npm:
if not (admin_web_dir / "node_modules").exists():
r = subprocess.run(
[npm, "install"],
cwd=admin_web_dir, capture_output=True, text=True,
)
log.append(f"$ npm install (admin web)\n{r.stdout}{r.stderr}")
if r.returncode != 0:
return False, "\n".join(log)
r = subprocess.run(
[npm, "run", "build"],
cwd=admin_web_dir, capture_output=True, text=True,
@ -298,8 +295,6 @@ class ServerManager:
log.append(f"$ npm run build (admin web)\n{r.stdout}{r.stderr}")
if r.returncode != 0:
return False, "\n".join(log)
else:
log.append("! npm not found on PATH -- skipping admin web frontend rebuild (go:embed will reuse the existing web/dist)")
for out_path, pkg in ((SERVER_EXE, "./cmd/telesrv"), (ADMIN_EXE, "./cmd/telesrv-admin")):
r = subprocess.run(
["go", "build", "-o", str(out_path), pkg],