antfu-collective / sponsorkit Goto Github PK
View Code? Open in Web Editor NEW๐ Toolkit for generating sponsors images ๐
License: MIT License
๐ Toolkit for generating sponsors images ๐
License: MIT License
As title
As title
No response
No response
I just tried this by adding both GitHub Sponsors and Open Collective tokens. The way this tool handle each is different.
For GitHub, it's taking into account the monthly value (as it should), but for Open Collective it's using the total, which results is a wrong output image.
Use GitHub and OpenCollective at the same time and see that they use different values.
System:
OS: macOS 12.6
CPU: (10) arm64 Apple M1 Pro
Memory: 89.61 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
Yarn: 1.22.18 - ~/.nvm/versions/node/v16.13.1/bin/yarn
npm: 8.6.0 - ~/.nvm/versions/node/v16.13.1/bin/npm
Browsers:
Brave Browser: 101.1.38.115
Chrome: 108.0.5359.94
Firefox: 107.0.1
Firefox Developer Edition: 108.0
Safari: 16.0
yarn
Currently, sponsorkit only allows sorting sponsors by sponsoring tiers.
That's great for some cases, but I'd like to sort them by the length of time a user has been a sponsor, like over 1 year, 6 months, 3 months, etc..., because continuous support is also an important thing for FLOSS maintainers, at least I believe so.
(Someone also may not want to reveal sponsors' tiers explicitly.)
The current implementation is tied to the sponsoring tiers so some tweaks to the config would be needed as well as sorting implementation.
I've implemented this in a quite dirty way (replacing tiers directly instead of adding an option): JohnTitor@f7d7b13
(The above way works fine for me, but it'd be great if upstream supported this use case so that I don't have to worry about my fork :))
No response
Thank you for the wonderful tool by the way!
When i use this project to generator my sponsors meta info. I found when i remove Backers
. And set anthor tier monthlyDollars
as 1. I got a mistake.
Just like
In my consola
I noticed that if I run the example it defaults to a blank which is normal. But there may be cases where the user deletes these isn't it? I think defaultComposer
should judge 0 and null(undefined) respectively.
Currently. In defaultComposer
logic is const finalSponsors = config.tiers!.filter(i => i.monthlyDollars == null || i.monthlyDollars === 0)
Related #7
Now sponsorkit
only supports platform sponsors. It is hard to add sponsors sponsored by wechat, alipay, etc.
We can specify a file read by unconfig
, named custom-sponsors.config.ts
or something. The file exports sponsors, matching type Sponsorship[]
.
No response
This is a raw idea. I will make a pr if this idea is possible.
First of all, thank you very much for this great project!
I am trying to retrieve the sponsorship details of this collective: https://opencollective.com/capawesome
The following two properties of the retrieved sponsorships are often incorrect: isOneTime
and monthlyDollars
.
Example 1:
Transaction: https://opencollective.com/capawesome/contributions/660052
The transaction was executed once (non-recurring). However, I receive the following values:
{
"sponsor": {
"name": "CTS Software",
"type": "User",
"login": "guest-2cf739c1",
"avatarUrl": "https://images.opencollective.com/guest-2cf739c1/avatar/460.png",
"websiteUrl": null,
"linkUrl": "https://opencollective.com/guest-2cf739c1",
"avatarUrlHighRes": "...",
"avatarUrlMediumRes": "...",
"avatarUrlLowRes": "..."
},
"isOneTime": false,
"monthlyDollars": 5000,
"privacyLevel": "PUBLIC",
"tierName": "โก Custom Plugin",
"createdAt": "2023-06-01T15:04:33.286Z",
"provider": "opencollective"
}
isOneTime
has the value false
, but should be true
.
Example 2:
Transactions:
This sponsor contributes 300$ per month and has contributed twice so far. However, I receive the following values:
{
"sponsor": {
"name": "AppScreens",
"type": "User",
"login": "appscreens",
"avatarUrl": "https://images.opencollective.com/appscreens/62776aa/avatar/460.png",
"websiteUrl": "https://appscreens.com/",
"linkUrl": "https://opencollective.com/appscreens",
"avatarUrlHighRes": "...",
"avatarUrlMediumRes": "...",
"avatarUrlLowRes": "..."
},
"isOneTime": true,
"monthlyDollars": 600,
"privacyLevel": "PUBLIC",
"tierName": "",
"createdAt": "2023-09-17T22:16:49.416Z",
"provider": "opencollective"
}
monthlyDollars
has the value 600
, but should have 300
.
https://github.com/capawesome-team/static
System:
OS: macOS 14.0
CPU: (10) arm64 Apple M1 Pro
Memory: 136.63 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.18.2 - /opt/homebrew/opt/node@18/bin/node
npm: 9.8.1 - /opt/homebrew/opt/node@18/bin/npm
pnpm: 8.10.2 - /opt/homebrew/bin/pnpm
Browsers:
Brave Browser: 96.1.32.115
Chrome: 119.0.6045.159
Safari: 17.0
npm
What I have as files :
./workflows/sponsor_gen.yml
./package.json
(like this one)./sponsor.config.ts
with defaults configs.In settings, I've got SPONSORS_TOKEN in Actions secrets with org:read and user:read perms.
When I run the action, I've got this error :
Run npm run build
npm run build
shell: /usr/bin/bash -e {0}
env:
SPONSORKIT_GITHUB_TOKEN: ***
SPONSORKIT_GITHUB_LOGIN: thomasbnt
> build
> sponsorkit
[log]
SponsorKit v0.[2](https://github.com/thomasbnt/sponsors/runs/5741141885?check_suite_focus=true#step:5:2).2
[info] Fetching sponsorships from github...
Error: GitHub token is required
at fetchGitHubSponsors (/home/runner/work/sponsors/sponsors/node_modules/.pnpm/[email protected]/node_modules/sponsorkit/dist/chunks/index.cjs:284:11)
at Object.fetchSponsors (/home/runner/work/sponsors/sponsors/node_modules/.pnpm/[email protected]/node_modules/sponsorkit/dist/chunks/index.cjs:279:12)
at run (/home/runner/work/sponsors/sponsors/node_modules/.pnpm/[email protected]/node_modules/sponsorkit/dist/cli.cjs:[3](https://github.com/thomasbnt/sponsors/runs/5741141885?check_suite_focus=true#step:5:3)[9](https://github.com/thomasbnt/sponsors/runs/5741141885?check_suite_focus=true#step:5:9):32)
at async Object.handler (/home/runner/work/sponsors/sponsors/node_modules/.pnpm/[email protected]/node_modules/sponsorkit/dist/cli.cjs:[13](https://github.com/thomasbnt/sponsors/runs/5741141885?check_suite_focus=true#step:5:13)0:3)
Error: Process completed with exit code 1.
How I can resolve this error?
For those who have not opened a sponsor but have received sponsorship from WeChat or other methods, I hope to have a custom hook that can pass in the user's github name and a sponsorship time, and then merge it into all sponsors.
{
customSponsors:[
{
username:'username',
sponsortime:'now',
...
}
]
}
No response
No response
Is it possible for this to have patreon support or is it out of scope?
Text overlaps on presets.large, similar to #3: https://github.com/GeopJr/GeopJr/blob/main/sponsors.svg
It was generated using GitHub actions on the latest
tag using this config and this action workflow
The above mentioned workflow, config and github login should reproduce it
(This is from action runner)
System:
OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
CPU: (2) x64 Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
Memory: 5.86 GB / 6.78 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 18.15.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.5.0 - /usr/local/bin/npm
Browsers:
Chrome: 111.0.5563.146
Chromium: 111.0.5547.0
Firefox: 111.0.1
npm
sponsorkit fetches the members of a collective on OpenCollective. This includes previous sponsors that are no longer active.
Additionally, the monthly amount is also off:
On OpenCollective, it is possible to change the amount associated with a tier on OpenCollective (unlike GitHub Sponsors, which requires tiers to be retired to change their amounts). The currently logic will return the current amount of the tier, not the amount actually payed by the sponsor.
If a sponsor didn't pay as part of a tier, then the total amount contributed by that sponsor is returned as the monthly price, which will lead to a much higher placement in the tiers.
The same applies to individual accounts (#32).
Fetch sponsors for https://opencollective.com/cheerio
npm
I have a cron workflow which is supposed to refresh github sponsors every night.
However, I see that every night it's generating a new image and committing the changes, leading to polluting the master branch.
When I check the svg file diff, it's just about swapping the places of the past sponsors.
I think the sponsorkit
should stable sort the fetched sponsors, so that the images are generated in the same way, so that the cron workflow will skip commit as no changes detected by git.
In local mode, cache.json
plays the role of the moderator, detecting no changes in fetched data.
However, in a cron workflow it might be harder to achieve.
If I delete it, it's again randomizing order of past sponsors.
https://github.com/MichalLytek/type-graphql/blob/master/.github/workflows/sponsor.yml
System:
OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
CPU: (16) x64 AMD Ryzen 7 5700X 8-Core Processor
Memory: 12.78 GB / 15.58 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 16.19.0 - ~/.nvm/versions/node/v16.19.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.19.0/bin/yarn
npm: 8.19.3 - ~/.nvm/versions/node/v16.19.0/bin/npm
npm
Patreon sponsors are not saved
https://github.com/anubra266/static
Github action and locally
pnpm
The latest version of sponsorkit
on npm is still 0.9.1
https://www.npmjs.com/package/sponsorkit?activeTab=versions
System:
OS: macOS 14.4
CPU: (12) arm64 Apple M2 Max
Memory: 1.34 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.19.0 - ~/Library/Caches/fnm_multishells/31908_1710819745664/bin/node
Yarn: 1.22.21 - ~/Library/Caches/fnm_multishells/31908_1710819745664/bin/yarn
npm: 10.2.3 - ~/Library/Caches/fnm_multishells/31908_1710819745664/bin/npm
pnpm: 8.15.4 - ~/Library/Caches/fnm_multishells/31908_1710819745664/bin/pnpm
bun: 1.0.31 - ~/.npm-global/bin/bun
Browsers:
Chrome: 122.0.6261.129
Chrome Canary: 124.0.6366.1
Safari: 17.4
n/a
Maybe we can display the past sponsors because I saw GitHub shows it in the sponsor profile.
{
title: 'Past Sponsors',
monthlyDollars: -1,
preset: presets.base,
},
No response
No response
I have a use case where the company will "sponsor" privately. There will be no records of it on Patreon / GitHub / etc. It would be great to allow providing a raw list of sponsors that are maintained manually.
I think this could be implemented either via a "JSON" provider - that reads the contents from a JSON file, or manual entries that could be placed directly on the sponsor.config.ts
file.
The advantage of using the sponsor.config.ts
is that auto-completion would make it easy to manually write entries. Implementing via JSON provider in the other hand would allow some custom automation to generate the raw entries.
No response
Please let me know what you think, I'd love to contribute with a PR for this.
The json is
{
"sponsor": {
"type": "User",
"login": "2f81b9544cc211eab9b352540025c377",
"name": "bi8bo",
"avatarUrl": "https://pic1.afdiancdn.com/user/2f81b9544cc211eab9b352540025c377/avatar/36cb8815b17691ea6dcb76e4a7cdca4b_w640_h640_s46.jpg",
"linkUrl": "https://afdian.net/u/2f81b9544cc211eab9b352540025c377"
},
"monthlyDollars": 12.307692307692308,
"privacyLevel": "PUBLIC",
"tierName": "Afdian",
"createdAt": "2022-02-27T05:48:54.000Z",
"expireAt": "2036-12-31T16:00:00.000Z",
"isOneTime": true,
"provider": "afdian",
"raw": {
"sponsor_plans": [
{
"can_ali_agreement": 0,
"plan_id": "08eb414c930711ec8d4d52540025c377",
"rank": 2147483647,
"user_id": "e97ad8460df611eab74952540025c377",
"status": 1,
"name": "",
"pic": "",
"desc": "",
"price": "80.00",
"update_time": 1645441896,
"timing": {
"timing_on": 0,
"timing_off": 0
},
"pay_month": 1,
"show_price": "80.00",
"show_price_after_adjust": "",
"has_coupon": 0,
"coupon": [],
"favorable_price": -1,
"independent": 0,
"permanent": 0,
"can_buy_hide": 1,
"need_address": 0,
"product_type": 1,
"sale_limit_count": -1,
"need_invite_code": false,
"bundle_stock": 0,
"bundle_sku_select_count": 0,
"config": {},
"has_plan_config": 0,
"expire_time": 2114352000,
"sku_processed": [
{
"sku_id": "08fdc2b8930711ecb30352540025c377",
"count": 1,
"name": "้ป่ฎคๅๅท",
"album_id": "",
"pic": "",
"stock": ""
}
],
"rankType": 30
}
],
"current_plan": {
"can_ali_agreement": 0,
"plan_id": "08eb414c930711ec8d4d52540025c377",
"rank": 2147483647,
"user_id": "e97ad8460df611eab74952540025c377",
"status": 1,
"name": "",
"pic": "",
"desc": "",
"price": "80.00",
"update_time": 1645441896,
"timing": {
"timing_on": 0,
"timing_off": 0
},
"pay_month": 1,
"show_price": "80.00",
"show_price_after_adjust": "",
"has_coupon": 0,
"coupon": [],
"favorable_price": -1,
"independent": 0,
"permanent": 0,
"can_buy_hide": 1,
"need_address": 0,
"product_type": 1,
"sale_limit_count": -1,
"need_invite_code": false,
"bundle_stock": 0,
"bundle_sku_select_count": 0,
"config": {},
"has_plan_config": 0,
"expire_time": 2114352000,
"sku_processed": [
{
"sku_id": "08fdc2b8930711ecb30352540025c377",
"count": 1,
"name": "้ป่ฎคๅๅท",
"album_id": "",
"pic": "",
"stock": ""
}
],
"rankType": 30
},
"all_sum_amount": "80.00",
"first_pay_time": 1645940934,
"last_pay_time": 1645940934,
"user": {
"user_id": "2f81b9544cc211eab9b352540025c377",
"name": "bi8bo",
"avatar": "https://pic1.afdiancdn.com/user/2f81b9544cc211eab9b352540025c377/avatar/36cb8815b17691ea6dcb76e4a7cdca4b_w640_h640_s46.jpg",
"user_private_id": "cef6ca339705e53384f3867031edc5844d5873ee"
}
}
},
This is the [ๅฎๅๅๅ](https://afdian.net/setting/shop)
, and for a onetime sponsor. But not expired.
"createdAt": "2022-02-27T05:48:54.000Z",
"expireAt": "2036-12-31T16:00:00.000Z",
"isOneTime": true,
I cannot provide reproduction. There is already a complete JSON above, or you can add product sales on "็ฑๅ็ต"
System:
OS: macOS 14.0
CPU: (8) arm64 Apple M2
Memory: 192.31 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.17.1 - ~/.n/bin/node
Yarn: 1.22.19 - ~/.n/bin/yarn
npm: 8.19.4 - ~/.n/bin/npm
pnpm: 8.7.0 - ~/.n/bin/pnpm
Watchman: 2023.09.04.00 - /opt/homebrew/bin/watchman
Browsers:
Safari: 17.0
pnpm
When I launch sponsorkit
, I get this error:
TypeError: Cannot read properties of null (reading 'isOneTime')
at xxx/node_modules/.pnpm/[email protected]/node_modules/sponsorkit/dist/index.cjs:478:25
Looking more into it, it seems that GitHub is returning null
to the tier
field now!
query {
organization(login: "MY_ORG") {
sponsorshipsAsMaintainer(first: 100) {
totalCount
pageInfo {
endCursor
hasNextPage
}
nodes {
createdAt
privacyLevel
tier { # <-- This field is null
name
isOneTime
monthlyPriceInCents
monthlyPriceInDollars
}
sponsorEntity {
__typename
...on Organization {
login
name
avatarUrl
websiteUrl
}
...on User {
login
name
avatarUrl
websiteUrl
}
}
}
}
}
}
I did check in the online https://docs.github.com/en/graphql/overview/explorer of github, and yes, I get all sponsors, but no tier
information (it's null).
I don't know from when, as it was working well before ๐
Any idea of where to ask for GitHub API changes ?
Should this case of tier null
be handle? (I could do a PR, but I'm not sure it's wanted... as we lose a lot of info.)
Let me know
https://github.com/HoudiniGraphql/sponsors
System:
OS: macOS 14.2.1
CPU: (12) arm64 Apple M3 Pro
Memory: 372.11 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.2.0 - ~/.nvm/versions/node/v21.2.0/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v21.2.0/bin/yarn
npm: 10.2.3 - ~/.nvm/versions/node/v21.2.0/bin/npm
pnpm: 8.10.5 - ~/Library/pnpm/pnpm
bun: 1.0.12 - ~/.bun/bin/bun
Browsers:
Chrome: 121.0.6167.160
Safari: 17.2.1
pnpm
Hello!
I've tried running the example and ended up with the following error when running the CLI:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:363:5)
at validateString (node:internal/validators:119:11)
at Object.resolve (node:path:1102:7)
at run (/Users/remirousselet/dev/rrousselgit/freezed/node_modules/sponsorkit/dist/cli.cjs:34:20)
at async Object.handler (/Users/remirousselet/dev/rrousselgit/freezed/node_modules/sponsorkit/dist/cli.cjs:132:3) {
code: 'ERR_INVALID_ARG_TYPE'
}
Diving into the sources, the problem appears to be the loadConfig
function, and how loadEnv
sets outputDir
to undefined
, which ends-up overriding the default config
TL;DR what happens is:
const defaultConfig = { outputDir: 'Hello' }
const env = { outputDir: undefined }
function loadConfig() {
return {
...defaultConfig,
...env
}
}
console.log(loadConfig()) // { outputDir: undefined }
https://github.com/orgs/community/discussions/38393#discussioncomment-4585678
_
_
pnpm
Use a default avatar when retrieving the avatar fails as mentioned on #10
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.