docs: correct contributor count mismatch (#8667)

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
Taesu
2026-03-18 16:40:10 +09:00
committed by GitHub
parent 69008867d0
commit b8febc2477
3 changed files with 20 additions and 10 deletions

View File

@@ -71,6 +71,7 @@ export default async function HomePage() {
stats={{
npmDownloads: communityStats.npmDownloads,
githubStars: communityStats.githubStars,
contributors: communityStats.contributors,
}}
/>
</div>

View File

@@ -1216,10 +1216,18 @@ function SentinelSection() {
const EMPTY_CONTRIBUTORS: ContributorInfo[] = [];
type CommunityHeroStats = {
npmDownloads: number;
githubStars: number;
contributors: number;
};
function ContributorsSection({
contributors = EMPTY_CONTRIBUTORS,
contributorCount,
}: {
contributors: ContributorInfo[];
contributorCount: number;
}) {
if (contributors.length === 0) return null;
@@ -1245,7 +1253,7 @@ function ContributorsSection({
<p className="text-[13px] text-foreground/50 dark:text-foreground/40 mb-5 leading-relaxed">
Built by a community of{" "}
<span className="text-foreground/70 dark:text-foreground/60 font-medium tabular-nums">
746+
{contributorCount}+
</span>{" "}
contributors.
</p>
@@ -1335,11 +1343,7 @@ const footerLinks = [
{ label: "Changelog", href: "/changelog" },
];
function ReadmeFooter({
stats,
}: {
stats: { npmDownloads: number; githubStars: number };
}) {
function ReadmeFooter({ stats }: { stats: CommunityHeroStats }) {
return (
<div className="relative mt-10 pt-8 pb-0 overflow-hidden">
{/* Watermark logo */}
@@ -1516,7 +1520,7 @@ export function HeroReadMe({
stats,
}: {
contributors: ContributorInfo[];
stats: { npmDownloads: number; githubStars: number };
stats: CommunityHeroStats;
}) {
const [socialHovered, setSocialHovered] = useState(false);
@@ -2522,7 +2526,10 @@ export function HeroReadMe({
</div>
</div>
<ContributorsSection contributors={contributors} />
<ContributorsSection
contributors={contributors}
contributorCount={stats.contributors}
/>
<ReadmeFooter stats={stats} />
</motion.article>

View File

@@ -18,6 +18,8 @@ export function getContributors(): ContributorInfo[] {
return staticContributors as ContributorInfo[];
}
const staticContributorsCount = staticContributors.length;
// Fetch NPM download stats for the last year
async function fetchNpmDownloads(): Promise<number> {
try {
@@ -75,7 +77,7 @@ async function fetchGitHubStats(): Promise<{
console.error("Failed to fetch GitHub repo stats:", repoResponse.status);
}
let contributorsCount = 100;
let contributorsCount = staticContributorsCount;
if (contributorsResponse.ok) {
const linkHeader = contributorsResponse.headers.get("Link");
if (linkHeader) {
@@ -94,7 +96,7 @@ async function fetchGitHubStats(): Promise<{
return { stars, contributors: contributorsCount };
} catch (error) {
console.error("Error fetching GitHub stats:", error);
return { stars: 26000, contributors: 100 };
return { stars: 26000, contributors: staticContributorsCount };
}
}