npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

Iโ€™ve always been into building performant and accessible sites, but lately Iโ€™ve been taking it extremely seriously. So much so that Iโ€™ve been building a tool to help me optimize and monitor the sites that I build to make sure that Iโ€™m making an attempt to offer the best experience to those who visit them. If youโ€™re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, ๐Ÿ‘‹, Iโ€™m Ryan Hefnerย  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If youโ€™re interested in other things Iโ€™m working on, follow me on Twitter or check out the open source projects Iโ€™ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soonโ€“ish.

Open Software & Tools

This site wouldnโ€™t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you ๐Ÿ™

ยฉ 2024 โ€“ย Pkg Stats / Ryan Hefner

all-contributors-for-repository

v0.3.0

Published

Generates an allcontributors list for an existing repository. ๐Ÿค

Downloads

4,973

Readme

Usage

npm i all-contributors-for-repository
import { getAllContributorsForRepository } from "all-contributors-for-repository";

const contributors = await getAllContributorsForRepository({
	owner: "JoshuaKGoldberg",
	repo: "template-typescript-node-package",
});

/*
{
  john_reilly: [ 'bug', 'code' ],
  joshuakgoldberg: [ 'maintenance', 'tool' ],
}
*/
console.log(contributors);

Warning This tool only sees contributions that can be detected from the last 500 events in GitHub's API. Don't forget to manually add in other forms of contributions!

The types of contributions detected from the GitHub API are:

  • ๐Ÿ› bug: anybody who filed an issue labeled as accepting PRs and a bug (see Options)
  • ๐Ÿ“– doc: authors of merged PRs that address issues labeled as accepting PRs and docs (see Options)
  • ๐Ÿšง maintenance: adding labels to issues and PRs, and merging PRs
  • ๐Ÿ‘€ review: submitting a review for a PR
  • ๐Ÿ”ง tool: authors of merged PRs that address issues labeled as accepting PRs and tooling (see Options)

Additionally, based on PR conventional commit titles in the Angular convention, for all PR authors and co-authors:

  • build and ci: will be treated as an :infra: contribution
  • docs: will be treated as an :doc: contribution
  • test: will be treated as an :test: contribution
  • All other PRs -including those without a conventional title- will be treated as :code: contributions

๐Ÿ’ก Given that list of contributors, you might want to run all-contributors add on each contributor & contribution type.

import { $ } from "execa";

for (const [contributor, contributions] of Object.entries(contributors)) {
	const contributionTypes = Object.keys(contributions).join(",");
	await $`npx all-contributors add ${contributor} ${contributionTypes}`;
}

Options

The exported getAllContributorsForRepository function takes in an object with two required properties:

  • owner (string): The owner of the repository to query, such as "JoshuaKGoldberg".
  • repository (string): The name of the repository to query, such as "all-contributors-for-repository".

It additionally allows for the following optional options.

  • auth (string): GitHub auth token to query the API with, if necessary for private repositories and/or to avoid rate limiting.
  • ignoredLogins (string[]): Usernames to ignore commits from, such as bot and bot-like users.
    • Default: "allcontributors", "allcontributors[bot]", "dependabot", "dependabot[bot]", "renovate", "renovate[bot]"
  • labelAcceptingPrs (string): Label to indicate an issue is accepting pull requests.
  • labelTypeBug (string): Label to indicate an issue is for a bug.
  • labelTypeDocs (string): Label to indicate an issue is for documentation.
  • labelTypeTool (string): Label to indicate an issue is for tooling.
import { getAllContributorsForRepository } from "all-contributors-for-repository";

getAllContributorsForRepository({
	auth: "abc123",
	ignoredLogins: ["MyBotLikeUser"],
	labelAcceptingPrs: "help wanted",
	labelTypeBug: "bug",
	labelTypeDocs: "docs",
	labelTypeTool: "tool",
});

Development

See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md. Thanks! ๐Ÿ’–

Contributors

๐Ÿ’™ This package is based on @JoshuaKGoldberg's create-typescript-app.