Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nyxb/sponsorhub
https://github.com/nyxb/sponsorhub
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nyxb/sponsorhub
- Owner: nyxb
- License: mit
- Created: 2023-11-08T07:39:19.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-09T04:50:06.000Z (about 1 year ago)
- Last Synced: 2024-12-22T15:34:18.798Z (about 1 month ago)
- Language: TypeScript
- Size: 213 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# SponsorHub
[![NPM version](https://img.shields.io/npm/v/sponsorhub?color=a1b858&label=)](https://www.npmjs.com/package/sponsorhub)
Toolkit for generating sponsors images. Supports **GitHub Sponsors**, **Patreon** and **OpenCollective**.
## Usage
Create `.env` file with:
```ini
; GitHub provider.
; Token requires the `read:user` and `read:org` scopes.
SPONSORHUB_GITHUB_TOKEN=
SPONSORHUB_GITHUB_LOGIN=; Patreon provider.
; Create v2 API key at https://www.patreon.com/portal/registration/register-clients
; and use the "Creator’s Access Token".
SPONSORHUB_PATREON_TOKEN=; OpenCollective provider.
; Create an API key at https://opencollective.com/applications
SPONSORHUB_OPENCOLLECTIVE_KEY=
; and provide the ID, slug or GitHub handle of your account.
SPONSORHUB_OPENCOLLECTIVE_ID=
; or
SPONSORHUB_OPENCOLLECTIVE_SLUG=
; or
SPONSORHUB_OPENCOLLECTIVE_GH_HANDLE=
; If it is a personal account, set it to `person`. Otherwise not set or set to `collective`
SPONSORHUB_OPENCOLLECTIVE_TYPE=
```> Only one provider is required to be configured.
Run:
```base
npx SPONSORHUB
```[Example Setup](./example/) | [GitHub Actions Setup](https://github.com/nyxb/static/blob/master/.github/workflows/scheduler.yml) | [Generated SVG](https://cdn.jsdelivr.net/gh/nyxb/static/sponsors.svg)
## Configurations
Create `sponsorhub.config.js` file with:
```ts
import { defineConfig, presets } from 'SPONSORHUB'export default defineConfig({
// Providers configs
github: {
login: 'nyxb',
type: 'user',
},
opencollective: {
// ...
},
patreon: {
// ...
},// Rendering configs
width: 800,
formats: ['json', 'svg', 'png'],
tiers: [
// Past sponsors, currently only supports GitHub
{
title: 'Past Sponsors',
monthlyDollars: -1,
preset: presets.xs,
},
// Default tier
{
title: 'Backers',
preset: presets.base,
},
{
title: 'Sponsors',
monthlyDollars: 10,
preset: presets.medium,
},
{
title: 'Silver Sponsors',
monthlyDollars: 50,
preset: presets.large,
},
{
title: 'Gold Sponsors',
monthlyDollars: 100,
preset: presets.xl,
},
],
})
```Also check [the example](./example/).
## Utils
You can also use SponsorHub programmatically:
```ts
import { fetchSponsors } from 'sponsorhub'const sponsors = await fetchSponsors(token, login)
```Check the type definition or source code for more utils available.
## Sponsors
## License
[MIT](./LICENSE) License © 2023 [Dennis Ollhoff aka nyxb](https://nyxb.nexus)