-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add header image and merge conflicts
- Loading branch information
Showing
28 changed files
with
1,304 additions
and
1,206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
|
||
export default { | ||
CONTEXT: process.env.CONTEXT, | ||
GITHUB_KEY: process.env.GITHUB_KEY, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
import eleventyFetch from '@11ty/eleventy-fetch'; | ||
import { config } from 'dotenv'; | ||
import { groupBy } from 'lodash-es'; | ||
|
||
// eslint-disable-next-line no-process-env | ||
if (!process.env.GITHUB_KEY) { | ||
// Load .env variables with dotenv | ||
config(); | ||
} | ||
|
||
// eslint-disable-next-line no-process-env | ||
const GITHUB_KEY = process.env.GITHUB_KEY; | ||
|
||
const FilteredProfiles = [ | ||
// if there are backers we need to exclude… | ||
]; | ||
|
||
const TIERS = ['Great Horned Owl', 'Blue-Footed Booby', 'Common Loon']; | ||
|
||
// https://docs.github.com/en/graphql/reference/objects#sponsorshipconnection | ||
const loadGithubSponsors = async () => { | ||
if (!GITHUB_KEY) { | ||
// eslint-disable-next-line no-console | ||
console.error('Github sponsors not loaded; set `GITHUB_KEY` in `.env`.'); | ||
return new Promise((resolve) => resolve([])); | ||
} | ||
const url = 'https://api.github.com/graphql?'; | ||
const { data } = await eleventyFetch(url, { | ||
type: 'json', | ||
duration: '0s', | ||
directory: '.cache/eleventy-fetch/', | ||
dryRun: false, | ||
fetchOptions: { | ||
method: 'POST', | ||
headers: { | ||
Authorization: `Bearer ${GITHUB_KEY}`, | ||
}, | ||
body: JSON.stringify({ | ||
query: `{ | ||
organization(login: "oddbird") { | ||
name | ||
sponsorshipsAsMaintainer(first: 100, activeOnly: false) { | ||
totalCount pageInfo { hasNextPage } | ||
nodes { | ||
sponsorEntity{ | ||
... on User { name avatarUrl websiteUrl url } | ||
... on Organization { name avatarUrl websiteUrl url } | ||
} | ||
} | ||
} | ||
} | ||
}`, | ||
}), | ||
}, | ||
}); | ||
if (data?.organization.sponsorshipsAsMaintainer.pageInfo.hasNextPage) { | ||
// eslint-disable-next-line no-console | ||
console.error( | ||
'Good news! We have over 100 GitHub sponsors and need to implement pagination.', | ||
); | ||
} | ||
return data?.organization.sponsorshipsAsMaintainer.nodes.map( | ||
({ sponsorEntity }) => ({ | ||
name: sponsorEntity.name, | ||
tier: 'Common Loon', | ||
website: sponsorEntity.websiteUrl || sponsorEntity.url, | ||
image: sponsorEntity.avatarUrl, | ||
total: 0, | ||
}), | ||
); | ||
}; | ||
|
||
const getDefaultOpenCollectiveAvatarUrl = (url) => { | ||
const slug = url.split('/').at(-1); | ||
return slug ? `https://images.opencollective.com/${slug}/avatar.png` : null; | ||
}; | ||
|
||
// https://opencollective.com/oddbird-open-source/members/all.json | ||
const loadOpenCollectiveSponsors = async () => { | ||
const url = | ||
'https://opencollective.com/oddbird-open-source/members/all.json?limit=1000'; | ||
const json = await eleventyFetch(url, { | ||
type: 'json', | ||
duration: '0s', | ||
directory: '.cache/eleventy-fetch/', | ||
dryRun: false, | ||
}); | ||
|
||
return json | ||
.filter( | ||
(c) => | ||
c.role === 'BACKER' && | ||
c.totalAmountDonated && | ||
c.tier !== 'Donation' && | ||
!FilteredProfiles.includes(c.name), | ||
) | ||
.map((c) => ({ | ||
name: c.name, | ||
tier: c.tier, | ||
website: c.website || c.profile, | ||
image: c.image || getDefaultOpenCollectiveAvatarUrl(c.profile), | ||
total: c.totalAmountDonated, | ||
})); | ||
}; | ||
|
||
export default async () => { | ||
try { | ||
const [ocSupporters, githubSponsors] = await Promise.all([ | ||
loadOpenCollectiveSponsors(), | ||
loadGithubSponsors(), | ||
]); | ||
|
||
const supporters = [...githubSponsors, ...ocSupporters].sort( | ||
(a, b) => | ||
// Sort by total amount donated (desc) | ||
b.total - a.total, | ||
); | ||
|
||
const tiers = groupBy(supporters, ({ tier }) => | ||
TIERS.find((t) => tier.startsWith(t)), | ||
); | ||
|
||
return { | ||
tiers, | ||
}; | ||
} catch (e) { | ||
// eslint-disable-next-line no-console | ||
console.error('Failed fetching Open Collective and GitHub backers.', e); | ||
return { | ||
tiers: {}, | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,29 @@ | ||
{ | ||
"lastFetched": "2024-06-10T08:06:27.948Z", | ||
"lastFetched": "2024-06-24T08:06:22.475Z", | ||
"children": [ | ||
{ | ||
"type": "entry", | ||
"author": { | ||
"type": "card", | ||
"name": "Nelson Chu Pavlosky", | ||
"photo": "https://webmention.io/avatar/cdn.masto.host/45776646d2a1df9c46739119072eb536e85dbc314de7a2e940f5a7af584e035b.jpg", | ||
"url": "https://jawns.club/@skyfaller" | ||
}, | ||
"url": "https://jawns.club/@skyfaller/112616664108172980", | ||
"published": "2024-06-14T19:38:42+00:00", | ||
"wm-received": "2024-06-14T20:00:29Z", | ||
"wm-id": 1834564, | ||
"wm-source": "https://brid.gy/comment/mastodon/@[email protected]/112614861718161804/112616664152485619", | ||
"wm-target": "https://www.oddbird.net/2024/06/13/css-layout/", | ||
"wm-protocol": "webmention", | ||
"content": { | ||
"html": "<p><span class=\"h-card\"><a href=\"https://front-end.social/@mxbck\" class=\"u-url\">@<span>mxbck</span></a></span> <span class=\"h-card\"><a href=\"https://front-end.social/@mia\" class=\"u-url\">@<span>mia</span></a></span> Got any suggestions for how best to learn CSS Grid?</p><p>This post about best practices for CSS Grid got me interested in it (I hope it's not outdated): <a href=\"https://vgpena.github.io/using-css-grid-the-right-way/\"><span>https://</span><span>vgpena.github.io/using-css-gri</span><span>d-the-right-way/</span></a></p><p>I always see this educational game mentioned, and I did find it fun, if a bit basic: <a href=\"https://cssgridgarden.com/\"><span>https://</span><span>cssgridgarden.com/</span><span></span></a></p>\n<a class=\"u-mention\" href=\"https://www.oddbird.net/2024/06/13/css-layout/\"></a>\n<a href=\"https://vgpena.github.io/using-css-grid-the-right-way/\">Using CSS Grid the right way</a>", | ||
"text": "@mxbck @mia Got any suggestions for how best to learn CSS Grid?\n\nThis post about best practices for CSS Grid got me interested in it (I hope it's not outdated): https://vgpena.github.io/using-css-grid-the-right-way/\n\nI always see this educational game mentioned, and I did find it fun, if a bit basic: https://cssgridgarden.com/\n\nUsing CSS Grid the right way" | ||
}, | ||
"in-reply-to": "https://www.oddbird.net/2024/06/13/css-layout/", | ||
"wm-property": "in-reply-to", | ||
"wm-private": false | ||
}, | ||
{ | ||
"type": "entry", | ||
"author": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.