0.2.1 • Published 4 months ago

github-sponsors-to-markdown v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Usage

npm i github-sponsors-to-markdown
import { githubSponsorsToMarkdown } from "github-sponsors-to-markdown";

console.log(await githubSponsorsToMarkdown());

Note that you'll need a GH_TOKEN environment variable. For example:

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! ⚡️

Options

githubSponsorsToMarkdown can be optionally be provided an options object.

await githubSponsorsToMarkdown({
	/* ... */
});
export interface GithubSponsorsToMarkdownOptions {
	auth: string;
	login?: string;
	tiers?: Record<string, SponsorshipTier>;
	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.

githubSponsorsToMarkdown({
	login: "JoshuaKGoldberg",
});

tier

Custom tiers to render instead of the defaults.

githubSponsorsToMarkdown({
	tiers: {
		"Also Awesome": {
			minimum: 10,
			size: 50,
		},
		Awesome: {
			label: "Best People Ever!",
			minimum: 100,
			size: 100,
		},
	},
});
export interface SponsorshipTier {
	label?: string;
	minimum: number;
	size: number;
}

verbose

Whether to console.log while executing. Useful for debugging unexpected results.

githubSponsorsToMarkdown({
	verbose: true,
});

This will log:

  • The login option
  • The response from querying GitHub's GraphQL API
  • Collected tiers from sponsorship groupings

Development

See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md. Thanks! 💖

Contributors

💙 This package is based on @JoshuaKGoldberg's template-typescript-node-package.

0.2.1

4 months ago

0.2.0

4 months ago

0.1.1

8 months ago

0.0.1

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.0

1 year ago