Skip to content

Commit

Permalink
Add global stats on contributions
Browse files Browse the repository at this point in the history
Clarify how and when we refresh, as well as the whole data set to date.
  • Loading branch information
kzu committed Sep 27, 2024
1 parent 65c6ccc commit 364779b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 22 additions & 1 deletion docs/assets/js/oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `<a href="https://github.com/devlooped/nuget/blob/main/nuget.json">Tracking</a> ${authorCount} authors contributing to ${repositoryCount} repositories producing ${packageCount} packages with ${totalDownloads} combined daily downloads. Learn <a href="https://github.com/devlooped/SponsorLink/blob/main/src/Commands/NuGetStatsCommand.cs">how</a> and <a href="https://github.com/devlooped/nuget/blob/main/.github/workflows/nuget.yml">when</a> your contributions are refreshed.`;
document.getElementById('summary').className = '';
setBusy(false);
});

Expand Down
2 changes: 2 additions & 0 deletions docs/github/oss.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
<p id="summary" style="font-style: italic; font-size: 85%;" class="hidden"></p>

This page allows you to check your eligibility for indirect sponsorship as an OSS author/contributor.

<div id="github">
Expand Down

0 comments on commit 364779b

Please sign in to comment.