devxy/build-cran-binaries
Watch
1
0
Fork
You've already forked build-cran-binaries
0

feat(stats): publish per-package download statistics #253

Merged
pat-s merged 2 commits from feat/download-stats-packages into main 2026-11-14 13:12:21 +00:00
Owner

Adds the data for the package view of the rpkgs.com download dashboard (rpkgs/website#98).

  • stats/packages.ts writes stats/packages/<name>.json per package: daily downloads and clients, latest version, 30-day rank, and versions, distributions, R versions and architectures for 7 days, 30 days and all time.
  • downloads.json gains packages and bytes per window and breakdownsByWindow; breakdowns stays as the 30-day set, so the current page keeps working.
  • Package files are uploaded before the main file and purged with one wildcard purge (/stats/packages/*, checked against the Bunny API).

Same counting rules as before: own runners excluded, a download is a distinct client, package version and UTC day.

Verification

  • bun test stats: 16 tests pass, including version ordering.
  • publish.ts --out against the live database wrote the main file and 106 package files; cli matches a direct SQL count (5 downloads, 2 clients, 3.6.6).

🤖 Generated with Claude Code

Adds the data for the package view of the rpkgs.com download dashboard (rpkgs/website#98). - `stats/packages.ts` writes `stats/packages/<name>.json` per package: daily downloads and clients, latest version, 30-day rank, and versions, distributions, R versions and architectures for 7 days, 30 days and all time. - `downloads.json` gains `packages` and `bytes` per window and `breakdownsByWindow`; `breakdowns` stays as the 30-day set, so the current page keeps working. - Package files are uploaded before the main file and purged with one wildcard purge (`/stats/packages/*`, checked against the Bunny API). Same counting rules as before: own runners excluded, a download is a distinct client, package version and UTC day. ## Verification - `bun test stats`: 16 tests pass, including version ordering. - `publish.ts --out` against the live database wrote the main file and 106 package files; `cli` matches a direct SQL count (5 downloads, 2 clients, 3.6.6). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Write one JSON file per package to stats/packages/<name>.json with its
daily series and its versions, distributions, R versions and
architectures for 7 days, 30 days and all time, for the package view
of the rpkgs.com dashboard.

- Add distinct package and byte counts to each window in downloads.json.
- Add breakdowns for every window as breakdownsByWindow, keeping
  breakdowns as the 30-day set for existing readers.
- Upload package files before the main file and purge them with one
  wildcard purge.
Give each package in downloads.json its downloads and clients for 7 days and all time as well as 30 days, so the dashboard's package table can follow the selected range.
pat-s merged commit fa1e8e8428 into main 2026-11-14 13:12:21 +00:00
pat-s deleted branch feat/download-stats-packages 2026-11-14 13:12:21 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
devxy/build-cran-binaries!253
No description provided.