from pathlib import Path APP_PARTS = ("core.js", "preferences.js", "config-history.js", "runtime.js", "settings.js") VHOST_PARTS = ("core.js", "health.js", "editor.js", "render.js") def _read(root: Path, folder: str, parts: tuple[str, ...]) -> str: return "\n".join((root / "src/admin/web" / folder / part).read_text(encoding="utf-8") for part in parts) def read_app_js(root: Path) -> str: return _read(root, "app", APP_PARTS) def read_vhosts_js(root: Path) -> str: body = _read(root, "vhosts", VHOST_PARTS) return "(() => {\n" + body + "\n})();\n"