Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
👋 Codeowner Review RequestThe following codeowners have been identified for the changed files: Team reviewers: @nodejs/nodejs-website Please review the changes when you have a chance. Thank you! 🙏 |
This comment was marked as off-topic.
This comment was marked as off-topic.
📦 Build Size ComparisonSummary
Changes➕ Added Assets (1)
➖ Removed Assets (1)
|
06c283f to
46d49e7
Compare
Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>
Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>
Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>
| const mapped = nodes.map(n => { | ||
| const s = n.sponsor || n.sponsorEntity || n.sponsorEntity; // support different field names | ||
| return { | ||
| name: s?.name || s?.login || null, | ||
| image: s?.avatarUrl || null, | ||
| url: s?.url || null, | ||
| source: 'github', | ||
| }; | ||
| }); | ||
|
|
||
| sponsors.push(...mapped); |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| const nodeRes = data.data.organization?.sponsorsActivities; | ||
|
|
||
| const { nodes } = nodeRes; |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Pull request overview
Adds GitHub Sponsors as an additional data source for the “Supporters” section, alongside OpenCollective, by updating the data generator and wiring the UI/docs to the new combined dataset.
Changes:
- Add GitHub Sponsors supporter type and update the Supporters UI to use a unified
urlfield. - Add GitHub GraphQL endpoint constant and implement GitHub Sponsors GraphQL fetching + shuffling in the supporters data generator.
- Update partners/supporters copy to mention GitHub Sponsors.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/site/types/supporters.ts | Introduces a GitHub sponsors supporter type alias. |
| apps/site/pages/en/about/partners.mdx | Updates “Supporters” copy to include GitHub Sponsors. |
| apps/site/next.constants.mjs | Adds GitHub GraphQL API endpoint constant. |
| apps/site/next-data/generators/supportersData.mjs | Expands generator to fetch/merge OpenCollective + GitHub Sponsors and shuffle results. |
| apps/site/components/Common/Supporters/index.tsx | Updates list rendering to use url (and support both sources). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| sponsors.push(...mapped); | ||
|
|
||
| return sponsors; |
There was a problem hiding this comment.
The two GitHub queries (sponsorshipsAsMaintainer and sponsorsActivities) will likely return overlapping sponsors, but the code concatenates both result sets without de-duplication. Consider de-duping by a stable key (e.g., sponsor databaseId/login/url) before shuffling to avoid repeated avatars.
| return sponsors; | |
| // De-duplicate sponsors from both queries using a stable key | |
| const seen = new Set(); | |
| const uniqueSponsors = []; | |
| for (const sponsor of sponsors) { | |
| const key = sponsor.url || `${sponsor.name || ''}::${sponsor.image || ''}`; | |
| if (seen.has(key)) { | |
| continue; | |
| } | |
| seen.add(key); | |
| uniqueSponsors.push(sponsor); | |
| } | |
| return uniqueSponsors; |
There was a problem hiding this comment.
hmm, even though it’s a good idea to try to deduplicate it, I don’t think this is the right approach. I’ll have to look into the logic of https://github.com/antfu-collective/sponsorkit33
| }; | ||
|
|
||
| export type OpenCollectiveSupporter = Supporter<'opencollective'>; | ||
| export type GithubSponsorSupporter = Supporter<'github'>; |
There was a problem hiding this comment.
Type name uses Github... capitalization. Elsewhere the codebase predominantly uses GitHub (e.g., GitHubApiFile, GitHubIcon). Consider renaming this to GitHubSponsorSupporter for consistency (and update JSDoc imports/usages accordingly).
| export type GithubSponsorSupporter = Supporter<'github'>; | |
| export type GitHubSponsorSupporter = Supporter<'github'>; |
|
|
||
| Supporters are individuals and organizations that provide financial support through | ||
| [OpenCollective](https://opencollective.com/nodejs) of the Node.js project. | ||
| [OpenCollective](https://opencollective.com/nodejs) and [GitHub Sponsors](https://github.com/sponsors/nodejs) of the Node.js project. |
There was a problem hiding this comment.
The sentence reads a bit ungrammatically as written (“through … and … of the Node.js project”). Consider rephrasing to “through … and … for the Node.js project” (or similar) to make the relationship clear.
| const graphql = async (query, variables = {}) => { | ||
| const res = await fetch(GITHUB_GRAPHQL_URL, { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| Authorization: `Bearer ${GITHUB_API_KEY}`, | ||
| }, | ||
| body: JSON.stringify({ query, variables }), | ||
| }); |
There was a problem hiding this comment.
For consistency/reliability, consider using fetchWithRetry for the GitHub GraphQL POST as well (this file already uses it for OpenCollective). That would reduce transient build/runtime failures due to network timeouts when generating supporters data.
| sponsorshipsAsMaintainer (first: 100, includePrivate: false, after: "${cursor}", activeOnly: false) { | ||
| nodes { | ||
| sponsor: sponsorEntity { | ||
| ...on User { | ||
| id: databaseId, | ||
| name, | ||
| login, | ||
| avatarUrl, | ||
| url, | ||
| websiteUrl | ||
| } | ||
| ...on Organization { | ||
| id: databaseId, | ||
| name, | ||
| login, | ||
| avatarUrl, | ||
| url, | ||
| websiteUrl | ||
| } | ||
| }, | ||
| } |
There was a problem hiding this comment.
The GraphQL query strings contain trailing commas after fields (e.g., id: databaseId,, name,, and a comma after the sponsorEntity { ... } block). GitHub’s GraphQL API does not accept comma-separated field selections, so this query will fail to parse. Remove the commas (and any trailing commas) from the query documents.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>
| organization(login: "nodejs") { | ||
| sponsorshipsAsMaintainer (first: 100, includePrivate: false, after: "${cursor}", activeOnly: false) { |
There was a problem hiding this comment.
definitely, I’d prefer that we only show sponsors that are active, but why do we want to show everyone? see #8268.
There was a problem hiding this comment.
wdyt @nodejs/nodejs-website @nodejs/marketing ?
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>

Description
Note that there’s no REST API for GitHub Sponsors, only a GraphQL API. I’m still working on this.
Preview:

Validation
Related Issues
closes #8199
Check List
pnpm formatto ensure the code follows the style guide.pnpm testto check if all tests are passing.pnpm buildto check if the website builds without errors.