Creates a Markdown table summarizing your GitHub sponsors. ๐ฐ
npm install github-sponsors-to-markdown
Creates a Markdown table summarizing your GitHub sponsors.
๐ฐ
``shell`
npm i github-sponsors-to-markdown
`ts
import { githubSponsorsToMarkdown } from "github-sponsors-to-markdown";
console.log(await githubSponsorsToMarkdown());
`
Note that you'll need a GH_TOKEN environment variable.
For example:
`shell`
gh auth refresh --scopes read:user # Only necessary your first time
GH_TOKEN=$(gh auth token) node build.js
> See this in action on github.com/JoshuaKGoldberg! โก๏ธ
githubSponsorsToMarkdown can be optionally be provided an options object.
`ts`
await githubSponsorsToMarkdown({
/ ... /
});
`ts
export interface GithubSponsorsToMarkdownOptions {
auth: string;
login?: string;
tiers?: Record
verbose?: boolean;
}
export const defaultOptions = {
tiers: {
Bronze: {
minimum: 5,
size: 25,
},
Gold: {
minimum: 25,
size: 100,
},
Silver: {
minimum: 10,
size: 50,
},
},
} satisfies GithubSponsorsToMarkdownOptions;
`
#### auth
GitHub auth token, such as what's provided by gh auth token.
#### login
GitHub organization or username to query sponsorships for.
If not provided, defaults to querying viewer.
`ts`
githubSponsorsToMarkdown({
login: "JoshuaKGoldberg",
});
#### tier
Custom tiers to render instead of the defaults.
`ts`
githubSponsorsToMarkdown({
tiers: {
"Also Awesome": {
minimum: 10,
size: 50,
},
Awesome: {
label: "Best People Ever!",
minimum: 100,
size: 100,
},
},
});
`ts`
export interface SponsorshipTier {
label?: string;
minimum: number;
size: number;
}
#### verbose
Whether to console.log while executing.
Useful for debugging unexpected results.
`ts`
githubSponsorsToMarkdown({
verbose: true,
});
This will log:
- The login option
- The response from querying GitHub's GraphQL API
- Collected tiers from sponsorship groupings
See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md.
Thanks! ๐ฐ
Josh Goldberg ๐ง ๐ ๐ป ๐ง ๐ ๐ค ๐ ๐ ๐ |
> ๐ This package was templated with create-typescript-app` using the Bingo engine.