From 364779beb7e883fb9f12e4e7839e458d1b5384c9 Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Fri, 27 Sep 2024 11:58:49 -0300 Subject: [PATCH] Add global stats on contributions Clarify how and when we refresh, as well as the whole data set to date. --- docs/assets/js/oss.js | 23 ++++++++++++++++++++++- docs/github/oss.md | 2 ++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/assets/js/oss.js b/docs/assets/js/oss.js index ab510308..9d589515 100644 --- a/docs/assets/js/oss.js +++ b/docs/assets/js/oss.js @@ -26,7 +26,28 @@ fetch('https://raw.githubusercontent.com/devlooped/nuget/refs/heads/main/nuget.j authors = Object.keys(data.authors).reduce((acc, key) => { acc[key.toLowerCase()] = data.authors[key]; return acc; - }, {}); + }, {}); + + const formatter = new Intl.NumberFormat(); + const authorCount = formatter.format(Object.keys(data.authors).length); + const repositoryCount = formatter.format(Object.keys(data.repositories).length); + + let packageCount = 0; + for (const repo in data.packages) { + packageCount += Object.keys(data.packages[repo]).length; + } + packageCount = formatter.format(packageCount); + + let totalDownloads = 0; + for (const repo in data.packages) { + for (const pkg in data.packages[repo]) { + totalDownloads += data.packages[repo][pkg]; + } + } + totalDownloads = formatter.format(totalDownloads); + + document.getElementById('summary').innerHTML = `Tracking ${authorCount} authors contributing to ${repositoryCount} repositories producing ${packageCount} packages with ${totalDownloads} combined daily downloads. Learn how and when your contributions are refreshed.`; + document.getElementById('summary').className = ''; setBusy(false); }); diff --git a/docs/github/oss.md b/docs/github/oss.md index f60d4516..4d4ab0ff 100644 --- a/docs/github/oss.md +++ b/docs/github/oss.md @@ -15,6 +15,8 @@ nuget packages that are open-source and are hosted on GitHub. > An active nuget package has at least 200 downloads per day in aggregate across the last 5 versions. + + This page allows you to check your eligibility for indirect sponsorship as an OSS author/contributor.