feat(site): generate the home page "Recently added" list from git history#40
Open
benjibromberg wants to merge 1 commit into
Open
feat(site): generate the home page "Recently added" list from git history#40benjibromberg wants to merge 1 commit into
benjibromberg wants to merge 1 commit into
Conversation
…tory The home page "Recently added" panel imported a hand-maintained, committed recent.json that — unlike every other file in site/src/content/data/ — the parser never generated and .gitignore never excluded. It silently went stale (frozen on mid-May content), so none of the additions merged afterwards showed. Replace it with a build-time generated artifact derived from `git log` over the canonical content files, mirroring the momentum snapshot in metrics.ts: a guarded git() wrapper that degrades to an empty list on a shallow clone rather than failing the build. Selection uses --no-merges (so PR-merged additions surface; --first-parent would hide them) and an addition-verb filter (so reorg/relabel commits stay out of a list titled "Recently added"); commit scope maps to kind and a keyword heuristic maps to the research-area dot. - add recent.ts (buildRecentModel) + RecentEntrySchema/RecentSchema in types.ts - wire build/validate/write of recent.json into generate-data.ts - move recent.json into site/.gitignore (now a regenerated build artifact) - add structure-only recent.test.ts (git-derived, so no exact-count ground truth)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
The home page "Recently added" panel was silently stale — frozen on mid-May content while ~37 papers, ~15 software tools, and several datasets/databases merged afterward never appeared.
Root cause:
RecentlyAdded.astroimported a hand-maintained, committedrecent.json. Unlike every other file insite/src/content/data/, the parser never generated it and.gitignorenever excluded it — so the build/deploy just shipped whatever was last committed (last touched May 28). The "View the full changelog →" link was live; only the curated teaser rotted.Fix
Turn
recent.jsoninto a build-time generated artifact derived fromgit log, so it refreshes on everypnpm parse/build/deploy and can't go stale again. It mirrors the existing git-momentum snapshot inmetrics.ts:recent.ts—buildRecentModel()runs one guardedgit logover the canonical content files (Papers.md,Software.md,Databases.md,Datasets,OtherResources.md), maps Conventional-Commit scope → kind, filters to addition-verb subjects (so reorg/relabel commits stay out of a list titled "Recently added"), and applies a keyword heuristic for the research-area dot (falling back totooling).--no-merges(not--first-parent) so PR-merged additions surface — this repo merges via merge commits, which--first-parentwould hide.fetch-depth: 0, so the live list is complete.)recent.jsonmoves intosite/.gitignore(now a regenerated build artifact);RecentEntrySchema/RecentSchemaadded totypes.ts; structure-onlyrecent.test.tsadded (git-derived, so no exact-count ground truth).No component change — the generated shape already matches
RecentlyAdded.astro({ date, kind, title, area }). No canonical-content edits.Verification
pnpm --dir site parse→recent.json (5 entries)— the June 11–12 adds (Pando, Context7, GGTA1 bovine deposit, Tac burger paper) + a field-gap add, newest-first, with sensible kind/area (the burger paper lands onsensory, matching its actual matrix cell).pnpm --dir site test→ 304 passing (incl. new 8-testrecent.test.ts).pnpm --dir site build→ 38 pages; builtdist/index.htmlrenders the five June entries and the stale May entries are gone.