@lizardbyte/contribkit 2025.612.34035 → 2025.626.150832

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import cac from 'cac';
2
- import { S as SvgComposer, i as generateBadge, p as partitionTiers, t as tierPresets, v as version, l as loadConfig, k as resolveProviders, j as guessProviders, r as resolveAvatars, q as outputFormats, s as svgToPng, g as svgToWebp } from './shared/contribkit.CbSdaFvs.mjs';
2
+ import { S as SvgComposer, i as generateBadge, p as partitionTiers, t as tierPresets, v as version, l as loadConfig, k as resolveProviders, j as guessProviders, r as resolveAvatars, q as outputFormats, s as svgToPng, g as svgToWebp } from './shared/contribkit.CoEmUqCL.mjs';
3
3
  import fs from 'node:fs';
4
4
  import fsp from 'node:fs/promises';
5
5
  import { resolve, dirname, relative, join } from 'node:path';
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { F as FALLBACK_AVATAR, G as GitHubProvider, P as ProvidersMap, S as SvgComposer, c as defaultConfig, b as defaultInlineCSS, a as defaultTiers, d as defineConfig, n as fetchGitHubSponsors, m as fetchSponsors, h as genSvgImage, i as generateBadge, j as guessProviders, l as loadConfig, o as makeQuery, q as outputFormats, p as partitionTiers, e as presets, f as resizeImage, r as resolveAvatars, k as resolveProviders, s as svgToPng, g as svgToWebp, t as tierPresets } from './shared/contribkit.CbSdaFvs.mjs';
1
+ export { F as FALLBACK_AVATAR, G as GitHubProvider, P as ProvidersMap, S as SvgComposer, c as defaultConfig, b as defaultInlineCSS, a as defaultTiers, d as defineConfig, n as fetchGitHubSponsors, m as fetchSponsors, h as genSvgImage, i as generateBadge, j as guessProviders, l as loadConfig, o as makeQuery, q as outputFormats, p as partitionTiers, e as presets, f as resizeImage, r as resolveAvatars, k as resolveProviders, s as svgToPng, g as svgToWebp, t as tierPresets } from './shared/contribkit.CoEmUqCL.mjs';
2
2
  import 'unconfig';
3
3
  import 'node:process';
4
4
  import 'dotenv';
@@ -201,7 +201,7 @@ function loadEnv() {
201
201
  return JSON.parse(JSON.stringify(config));
202
202
  }
203
203
 
204
- const version = "2025.612.34035";
204
+ const version = "2025.626.150832";
205
205
 
206
206
  async function fetchImage(url) {
207
207
  const arrayBuffer = await $fetch(url, {
@@ -1526,7 +1526,7 @@ async function fetchPatreonSponsors(token) {
1526
1526
  );
1527
1527
  const userCampaignId = userData.data[0].id;
1528
1528
  const sponsors = [];
1529
- let sponsorshipApi = `https://www.patreon.com/api/oauth2/v2/campaigns/${userCampaignId}/members?include=user&fields%5Bmember%5D=currently_entitled_amount_cents,patron_status,pledge_relationship_start,lifetime_support_cents&fields%5Buser%5D=image_url,url,first_name,full_name&page%5Bcount%5D=100`;
1529
+ let sponsorshipApi = `https://www.patreon.com/api/oauth2/v2/campaigns/${userCampaignId}/members?include=user,currently_entitled_tiers&fields%5Bmember%5D=currently_entitled_amount_cents,patron_status,pledge_relationship_start,lifetime_support_cents&fields%5Buser%5D=image_url,url,first_name,full_name&fields%5Btier%5D=amount_cents&page%5Bcount%5D=100`;
1530
1530
  do {
1531
1531
  const sponsorshipData = await $fetch(sponsorshipApi, {
1532
1532
  method: "GET",
@@ -1540,14 +1540,17 @@ async function fetchPatreonSponsors(token) {
1540
1540
  ...sponsorshipData.data.filter((membership) => membership.attributes.patron_status !== null).map((membership) => ({
1541
1541
  membership,
1542
1542
  patron: sponsorshipData.included.find(
1543
- (v) => v.id === membership.relationships.user.data.id
1543
+ (v) => v.type === "user" && v.id === membership.relationships.user.data.id
1544
+ ),
1545
+ tier: sponsorshipData.included.find(
1546
+ (v) => v.type === "tier" && v.id === membership.relationships.currently_entitled_tiers.data[0]?.id
1544
1547
  )
1545
1548
  }))
1546
1549
  );
1547
1550
  sponsorshipApi = sponsorshipData.links?.next;
1548
1551
  } while (sponsorshipApi);
1549
- const processed = sponsors.map(
1550
- (raw) => ({
1552
+ const processed = sponsors.map((raw) => {
1553
+ const sponsor = {
1551
1554
  sponsor: {
1552
1555
  avatarUrl: raw.patron.attributes.image_url,
1553
1556
  login: raw.patron.attributes.first_name,
@@ -1558,14 +1561,18 @@ async function fetchPatreonSponsors(token) {
1558
1561
  },
1559
1562
  isOneTime: false,
1560
1563
  // One-time pledges not supported
1561
- // The "former_patron" and "declined_patron" both is past sponsors
1562
- monthlyDollars: ["former_patron", "declined_patron"].includes(raw.membership.attributes.patron_status) ? -1 : Math.floor(raw.membership.attributes.currently_entitled_amount_cents / 100),
1564
+ monthlyDollars: Math.floor(raw.membership.attributes.currently_entitled_amount_cents / 100),
1563
1565
  privacyLevel: "PUBLIC",
1564
1566
  // Patreon is all public
1565
1567
  tierName: "Patreon",
1566
1568
  createdAt: raw.membership.attributes.pledge_relationship_start
1567
- })
1568
- );
1569
+ };
1570
+ if (["former_patron", "declined_patron"].includes(raw.membership.attributes.patron_status))
1571
+ sponsor.monthlyDollars = -1;
1572
+ else if (sponsor.monthlyDollars <= 0 && (raw.tier?.attributes.amount_cents || 0) > 0)
1573
+ sponsor.monthlyDollars = Math.floor(raw.tier.attributes.amount_cents / 100);
1574
+ return sponsor;
1575
+ });
1569
1576
  return processed;
1570
1577
  }
1571
1578
 
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/LizardByte/contribkit.git"
7
7
  },
8
- "version": "2025.612.34035",
8
+ "version": "2025.626.150832",
9
9
  "description": "Toolkit for generating contributor images",
10
10
  "license": "MIT",
11
11
  "funding": "https://app.lizardbyte.dev",