nomadro/apps/nomadweb/redmini/scripts/assemble.py
eric d93a355fd5 Migrate navmini/ebook/nomadweb into apps/ as same-origin portal subpaths.
Shield external portal jumps (keep EXTERNAL_* for later), serve /nav from static build, and proxy /book + /community to vertical Next apps with Caddy notes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-28 03:30:34 -05:00

43 lines
1.0 KiB
Python

#!/usr/bin/env python3
"""Copy tool/ + src/data.js into release/ for XHS zip (H5 mirror)."""
from __future__ import annotations
import shutil
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
TOOL = ROOT / "tool"
SRC_DATA = ROOT / "src" / "data.js"
RELEASE = ROOT / "release"
FILES = (
"index.html",
"app.js",
"nomadro.css",
"xhs-bridge.js",
)
def main() -> int:
if RELEASE.exists():
shutil.rmtree(RELEASE)
RELEASE.mkdir(parents=True)
for name in FILES:
src = TOOL / name
if not src.exists():
print(f"missing {src}")
return 1
shutil.copy2(src, RELEASE / name)
if not SRC_DATA.exists():
print(f"missing {SRC_DATA} — run: python scripts/build_data.py")
return 1
shutil.copy2(SRC_DATA, RELEASE / "data.js")
# keep a copy in tool/ for local preview
shutil.copy2(SRC_DATA, TOOL / "data.js")
print(f"assembled {RELEASE}")
return 0
if __name__ == "__main__":
raise SystemExit(main())