Files
treg/hatch_build.py
SToneX b279e6fb51 chore(web): remove the legacy dashboard and its rollout switch
Every visitor has been on the compiled Dashboard since the 100% rollout, so
the frozen legacy snapshot, its asset route, the per-account selection and
the three TREG_DASHBOARD_ROLLOUT_* settings go. Catalog pages and shared
links no longer look up the session to pick a frontend, /search is always
served, and the app-version stamp is the bundle hash alone. Rollback is now
a deploy of the previous build.
2026-09-25 21:26:40 +08:00

23 lines
1.0 KiB
Python

"""Require prebuilt dashboard assets in distributable packages, never in editable installs."""
from pathlib import Path
import re
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
class CustomBuildHook(BuildHookInterface):
def initialize(self, version, build_data):
if version == "editable":
return
index = Path(self.root) / "src/treg/web/dashboard/index.html"
if not index.is_file():
raise RuntimeError(
"Dashboard assets are missing. Run bash scripts/build-dashboard.sh before uv build."
)
build_data["artifacts"].append("src/treg/web/dashboard/**")
web = index.parent.parent
for url in re.findall(r'src="([^"]*/vendor/vue-[^"]+\.js)"', (web / "enrich-arena.html").read_text()):
if not (web / url.lstrip("/")).is_file():
raise RuntimeError("Vue runtime is missing. Run bash scripts/build-dashboard.sh.")
build_data["artifacts"].extend(["src/treg/web/vendor/*.js", "src/treg/web/vendor/LICENSE"])