Skip to content

Commit df0e2fe

Browse files
committed
feat(site): publish summary.json alongside the catalog
TechAPI's homepage counted this repo by fetching catalog.json and reading .length. That stops working as satellites grow — game-catalog is ~1M records — so the page now reads a count from summary.json instead.
1 parent 0d4dc10 commit df0e2fe

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ coverage.xml
3131
# Generated site catalog (rebuilt in CI)
3232
site/catalog.json
3333
site/history.json
34+
site/summary.json
3435

3536
# Local GitHub setup helpers (not part of the catalog)
3637
.github-setup/

‎site/build.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
import json
66
import subprocess
77
import sys
8+
from datetime import UTC, datetime
89
from pathlib import Path
910

1011
ROOT = Path(__file__).resolve().parent.parent
1112
DATA = ROOT / "data" / "cpu"
1213
OUT = Path(__file__).resolve().parent / "catalog.json"
1314
HISTORY = Path(__file__).resolve().parent / "history.json"
15+
SUMMARY = Path(__file__).resolve().parent / "summary.json"
1416

1517

1618
def git(*args: str) -> str:
@@ -50,6 +52,15 @@ def main() -> int:
5052
)
5153
OUT.write_text(json.dumps(records, indent=2) + "\n", encoding="utf-8")
5254
print(f"wrote {OUT} ({len(records)} ES records)")
55+
# TechAPI's homepage counts satellites from summary.json rather than by
56+
# downloading a record listing — game-catalog is ~1M records, so reading
57+
# a catalog's .length stopped being viable there.
58+
summary = {
59+
"count": len(records),
60+
"generated_at": datetime.now(UTC).strftime("%Y-%m-%dT%H:%M:%SZ"),
61+
}
62+
SUMMARY.write_text(json.dumps(summary, indent=2) + "\n", encoding="utf-8")
63+
print(f"wrote {SUMMARY} ({len(records)} records)")
5364
history = build_history()
5465
HISTORY.write_text(json.dumps({"points": history}, indent=2) + "\n", encoding="utf-8")
5566
print(f"wrote {HISTORY} ({len(history)} points)")

0 commit comments

Comments
 (0)