v0.5.59: item counter evidence for fears, catch up Web features to site version.
Ship OpenDota counter-stats reordering for feared items, finalize SITE_VERSION/docs for rankings/streamers/trends/matches/mechanics and draft archetypes, and ignore regenerable Web data caches. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Export the relations preview as a static site (no server needed).
|
||||
"""Export the Climperor web site as a static bundle (no server needed).
|
||||
|
||||
Usage:
|
||||
python export_relations_site.py [--out dist/relations] [--with-videos]
|
||||
@@ -35,13 +35,16 @@ from common import (
|
||||
HERO_PORTRAITS,
|
||||
ITEM_CAT_ICONS,
|
||||
ITEM_ICONS,
|
||||
RANK_ICONS,
|
||||
ROOT,
|
||||
STREAMER_AVATARS,
|
||||
STREAMER_VIDEOS,
|
||||
TEMPLATES_CDN,
|
||||
UI_ICONS,
|
||||
)
|
||||
from serve_relations import WEB_DIR, build_payload
|
||||
|
||||
SITE_VERSION = "0.4.2"
|
||||
SITE_VERSION = "0.5.59"
|
||||
DEFAULT_OSS_BASE = "https://climperor.oss-cn-shanghai.aliyuncs.com"
|
||||
|
||||
|
||||
@@ -58,14 +61,32 @@ def copy_glob(src: Path, dst: Path, pattern: str = "*.png") -> int:
|
||||
|
||||
|
||||
def populate_static_assets(out: Path, payload: dict) -> dict[str, int]:
|
||||
"""Copy preview image dirs into ``out`` (portrait/item/ability/...)."""
|
||||
"""Copy web site image dirs into ``out`` (portrait/item/ability/...)."""
|
||||
counts = {
|
||||
"attr": copy_glob(ATTR_ICONS, out / "attr"),
|
||||
"rank": copy_glob(RANK_ICONS, out / "rank", "rank*.png"),
|
||||
"item": copy_glob(ITEM_ICONS, out / "item"),
|
||||
"item-cat": copy_glob(ITEM_CAT_ICONS, out / "item-cat", "itemcat_*.png"),
|
||||
"ability": copy_glob(ABILITY_ICONS, out / "ability"),
|
||||
"ui-icon": copy_glob(UI_ICONS, out / "ui-icon"),
|
||||
"streamer-avatar": 0,
|
||||
"streamer-video": 0,
|
||||
}
|
||||
if STREAMER_AVATARS.is_dir():
|
||||
n_av = 0
|
||||
for pattern in ("*.jpg", "*.jpeg", "*.png", "*.webp"):
|
||||
n_av += copy_glob(STREAMER_AVATARS, out / "streamer-avatar", pattern)
|
||||
counts["streamer-avatar"] = n_av
|
||||
if STREAMER_VIDEOS.is_dir():
|
||||
n_vid = 0
|
||||
dst = out / "streamer-video"
|
||||
dst.mkdir(parents=True, exist_ok=True)
|
||||
for f in sorted(STREAMER_VIDEOS.glob("*.mp4")):
|
||||
if not f.is_file() or f.name.startswith("_"):
|
||||
continue
|
||||
shutil.copy2(f, dst / f.name)
|
||||
n_vid += 1
|
||||
counts["streamer-video"] = n_vid
|
||||
|
||||
portrait_dst = out / "portrait"
|
||||
portrait_dst.mkdir(exist_ok=True)
|
||||
@@ -114,7 +135,7 @@ def write_config_js(
|
||||
|
||||
def main() -> None:
|
||||
ap = argparse.ArgumentParser(
|
||||
description="Export relations preview as a static site"
|
||||
description="Export Climperor web site as a static bundle"
|
||||
)
|
||||
ap.add_argument("--out", default=str(ROOT / "dist" / "relations"))
|
||||
ap.add_argument(
|
||||
@@ -173,7 +194,19 @@ def main() -> None:
|
||||
)
|
||||
|
||||
if static_base:
|
||||
counts = {name: 0 for name in ("attr", "item", "item-cat", "ability", "ui-icon", "portrait")}
|
||||
counts = {
|
||||
name: 0
|
||||
for name in (
|
||||
"attr",
|
||||
"item",
|
||||
"item-cat",
|
||||
"ability",
|
||||
"ui-icon",
|
||||
"portrait",
|
||||
"streamer-avatar",
|
||||
"streamer-video",
|
||||
)
|
||||
}
|
||||
print(" static assets: omitted (STATIC_ASSET_BASE set — served from OSS)")
|
||||
else:
|
||||
counts = populate_static_assets(out, payload)
|
||||
|
||||
Reference in New Issue
Block a user