Skip to content

Commit 89dd7c5

Browse files
committed
Sort sponsors by contribution amount
1 parent 414e3f2 commit 89dd7c5

2 files changed

Lines changed: 39 additions & 26 deletions

File tree

scripts/fetch-sponsors.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ const query = `{
1111
}
1212
edges {
1313
node {
14+
tier {
15+
monthlyPriceInDollars
16+
}
1417
sponsorEntity {
1518
__typename
1619
... on User {
@@ -32,15 +35,20 @@ const query = `{
3235

3336
function organizationToSponsors(organization) {
3437
const edges = organization.sponsorshipsAsMaintainer.edges;
35-
return edges.map((edge) => {
36-
const { sponsorEntity } = edge.node;
3738

38-
return {
39-
avatarUrl: sponsorEntity.avatarUrl,
40-
username: sponsorEntity.login,
41-
name: sponsorEntity.name,
42-
};
43-
});
39+
return edges
40+
.map((edge) => {
41+
const { sponsorEntity, tier } = edge.node;
42+
43+
return {
44+
avatarUrl: sponsorEntity.avatarUrl,
45+
username: sponsorEntity.login,
46+
name: sponsorEntity.name,
47+
amount: tier?.monthlyPriceInDollars ?? 0,
48+
};
49+
})
50+
.sort((a, b) => b.amount - a.amount)
51+
.map(({ amount, ...sponsor }) => sponsor);
4452
}
4553

4654
async function fetchSponsorsAsync() {

src/data/sponsors.js

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
export default [
2+
{
3+
avatarUrl: 'https://avatars.githubusercontent.com/u/2443340?v=4',
4+
username: 'toyokumo',
5+
name: 'TOYOKUMO',
6+
},
27
{
38
avatarUrl:
4-
'https://avatars.githubusercontent.com/u/360412?u=15e7b90eb91a3d2b410f7f47461862cb793398ff&v=4',
9+
'https://avatars.githubusercontent.com/u/79333934?u=d18e4c6a4e063534d6fd7e77e0d51c367c91cfa0&v=4',
10+
username: 'finanzguru',
11+
name: 'Finanzguru',
12+
},
13+
{
14+
avatarUrl:
15+
'https://avatars.githubusercontent.com/u/11586195?u=aa64c53edaafde39585dca1e52b580a901bbd0b1&v=4',
16+
username: 'daniel-xyz',
17+
name: 'Daniel Bischoff',
18+
},
19+
{
20+
avatarUrl:
21+
'https://avatars.githubusercontent.com/u/360412?u=55c69a51df2c8e7c71d46d6ddb8fcbae3b616782&v=4',
522
username: 'jyc',
623
name: null,
724
},
@@ -17,23 +34,12 @@ export default [
1734
username: 'JonnyBurger',
1835
name: 'Jonny Burger',
1936
},
20-
{
21-
avatarUrl: 'https://avatars.githubusercontent.com/u/2443340?v=4',
22-
username: 'toyokumo',
23-
name: 'TOYOKUMO',
24-
},
2537
{
2638
avatarUrl:
2739
'https://avatars.githubusercontent.com/u/4328772?u=c4e0fd72bd7cdb3751166c8ade8ef253e6f5ba67&v=4',
2840
username: 'itsrifat',
2941
name: 'Moinul Hossain',
3042
},
31-
{
32-
avatarUrl:
33-
'https://avatars.githubusercontent.com/u/6936373?u=4edd14e6636c45d10ac6a3eecb4b3ffa6cc2bf5c&v=4',
34-
username: 'Naturalclar',
35-
name: 'Jesse Katsumata',
36-
},
3743
{
3844
avatarUrl:
3945
'https://avatars.githubusercontent.com/u/7029942?u=5eb1fed31f05fe97bcb07227268165c4028cc662&v=4',
@@ -52,6 +58,11 @@ export default [
5258
username: 'EvanBacon',
5359
name: 'Evan Bacon',
5460
},
61+
{
62+
avatarUrl: 'https://avatars.githubusercontent.com/u/12032251?v=4',
63+
username: 'burakakyol',
64+
name: 'Burak Akyol',
65+
},
5566
{
5667
avatarUrl:
5768
'https://avatars.githubusercontent.com/u/15199031?u=5a82dcb32237282ff576c0446567a1e2fe49b868&v=4',
@@ -64,12 +75,6 @@ export default [
6475
username: 'sayurimizuguchi',
6576
name: 'Sayuri Mizuguchi',
6677
},
67-
{
68-
avatarUrl:
69-
'https://avatars.githubusercontent.com/u/79333934?u=d18e4c6a4e063534d6fd7e77e0d51c367c91cfa0&v=4',
70-
username: 'finanzguru',
71-
name: 'Finanzguru',
72-
},
7378
{
7479
avatarUrl: 'https://avatars.githubusercontent.com/u/140319444?v=4',
7580
username: 'jupli-apps',

0 commit comments

Comments
 (0)