From e282ce24fd4db2db5096ccdcb3eddf9798a32c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Colombaro?= Date: Sun, 22 Mar 2026 23:04:49 +0100 Subject: [PATCH 1/4] Refactor fetchSponsors to use consume GitHub Sponsors --- scripts/fetchSponsors.mjs | 88 ++++++++++++++++++++++---------- src/components/Sponsors/index.js | 11 ++-- 2 files changed, 64 insertions(+), 35 deletions(-) diff --git a/scripts/fetchSponsors.mjs b/scripts/fetchSponsors.mjs index 53e873c..9afed12 100644 --- a/scripts/fetchSponsors.mjs +++ b/scripts/fetchSponsors.mjs @@ -9,32 +9,52 @@ * https://github.com/jestjs/jest/blob/bd1c6db7c15c23788ca3e09c919138e48dd3b28a/website/fetchSupporters.js */ -import fs from 'fs' -import path from 'path' -import { promisify } from 'util' +import fs from 'node:fs' +import path from 'node:path' +import { promisify } from 'node:util' import { gql, request } from 'graphql-request' // These sponsors will be featured on the homepage. -// These backers donate >100 USD per month, and are -// reviewed by the Jest team to confirm they are not -// donating just to juice their SEO. +// These backers are reviewed by the team to confirm +// they are not donating just to juice their SEO. const FEATURED_SPONSORS = new Set(['route4me']) -const graphqlQuery = gql` +const opencollectiveGraphqlQuery = gql` { account(slug: "yourls") { orders(status: ACTIVE, limit: 1000) { nodes { - tier { - slug - } - fromAccount { + sponsorEntity: fromAccount { name slug website imageUrl } - totalDonations { - value + } + } + } + } +` + +const githubGraphqlQuery = gql` + { + organization(login: "YOURLS") { + sponsorshipsAsMaintainer(first: 100, activeOnly: true) { + nodes { + sponsorEntity { + ... on Organization { + name + slug: login + url + website: websiteUrl + imageUrl: avatarUrl + } + ... on User { + name + slug: login + url + website: websiteUrl + imageUrl: avatarUrl + } } } } @@ -43,23 +63,35 @@ const graphqlQuery = gql` ` const writeFile = promisify(fs.writeFile) +const featuredBackers = (backer) => { + if (FEATURED_SPONSORS.has(backer.sponsorEntity.slug)) { + backer.featured = true + } + return backer +} -request('https://api.opencollective.com/graphql/v2', graphqlQuery) - .then((data) => { - const backers = data.account.orders.nodes - - const backersWithFeatured = backers.map((backer) => { - if (FEATURED_SPONSORS.has(backer.fromAccount.slug)) { - backer.featured = true - } - return backer - }) - - return writeFile( +Promise.all([ + request( + 'https://api.opencollective.com/graphql/v2', + opencollectiveGraphqlQuery, + ).then((data) => data.account.orders.nodes.map(featuredBackers)), + request( + 'https://api.github.com/graphql', + githubGraphqlQuery, + {}, + { + Authorization: `Bearer ${process.env.GITHUB_TOKEN}`, + }, + ).then((data) => + data.organization.sponsorshipsAsMaintainer.nodes.map(featuredBackers), + ), +]) + .then((data) => + writeFile( path.resolve(path.dirname(''), 'backers.json'), - JSON.stringify(backersWithFeatured), - ) - }) + JSON.stringify([].concat(...data)), + ), + ) .then(() => { console.log('Fetched 1 file: backers.json') }) diff --git a/src/components/Sponsors/index.js b/src/components/Sponsors/index.js index 86572c7..c01214d 100644 --- a/src/components/Sponsors/index.js +++ b/src/components/Sponsors/index.js @@ -4,18 +4,15 @@ import Link from '@docusaurus/Link' import styles from './styles.module.css' import backers from '@site/backers.json' -function Sponsor({ - fromAccount: { name, slug, website, imageUrl }, - totalDonations, -}) { +function Sponsor({ sponsorEntity: { name, slug, website, url, imageUrl } }) { return ( { Date: Mon, 6 Apr 2026 16:38:50 +0000 Subject: [PATCH 2/4] Ensure token availability for sponsors fetch script --- .github/workflows/publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6e7228f..4cbb93b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,6 +31,8 @@ jobs: - name: Fetch sponsors run: npm run fetch-sponsors --if-present + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run build run: npm run build --if-present From afcb6b55e82d703a58bca2d15e3b972cc4ae5644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Colombaro?= Date: Mon, 6 Apr 2026 16:51:13 +0000 Subject: [PATCH 3/4] Reword and restructure sponsors block --- src/components/Sponsors/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Sponsors/index.js b/src/components/Sponsors/index.js index c01214d..52e1753 100644 --- a/src/components/Sponsors/index.js +++ b/src/components/Sponsors/index.js @@ -31,8 +31,10 @@ export default function Sponsors() {

Featured Sponsors

+ YOURLS is free and open source, made possible by wonderful sponsors. +
For their outstanding support to the project, we are very thankful to - our Angel Sponsors. + them.

- YOURLS is free and open source, made possible by wonderful sponsors. -
Date: Mon, 6 Apr 2026 16:54:56 +0000 Subject: [PATCH 4/4] Move the latest featured sponsor to the expected workflow --- scripts/fetchSponsors.mjs | 2 +- src/components/Sponsors/index.js | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/scripts/fetchSponsors.mjs b/scripts/fetchSponsors.mjs index 9afed12..dea1b1f 100644 --- a/scripts/fetchSponsors.mjs +++ b/scripts/fetchSponsors.mjs @@ -17,7 +17,7 @@ import { gql, request } from 'graphql-request' // These sponsors will be featured on the homepage. // These backers are reviewed by the team to confirm // they are not donating just to juice their SEO. -const FEATURED_SPONSORS = new Set(['route4me']) +const FEATURED_SPONSORS = new Set(['route4me', 'BairesDev-LLC']) const opencollectiveGraphqlQuery = gql` { account(slug: "yourls") { diff --git a/src/components/Sponsors/index.js b/src/components/Sponsors/index.js index 52e1753..beb82f9 100644 --- a/src/components/Sponsors/index.js +++ b/src/components/Sponsors/index.js @@ -35,18 +35,6 @@ export default function Sponsors() {
For their outstanding support to the project, we are very thankful to them. -
-
- bd-logo-orange -

{backers