mirror of
https://github.com/superdesigndev/treg.git
synced 2026-10-02 03:24:35 +08:00
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.
23 lines
1.0 KiB
Python
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"])
|