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

github-contributors-list

v1.2.5

Published

Node.js script, which outputs all the contributors for given project in different formats

Downloads

1,119

Readme

Contributors list

Build awesome list of the contributors of your project! You can even filter your contributors to list only those individuals who committed after a specific date or who committed to a specific branch or SHA.

Demo

Usage

In order to get the contributors list for your open-source project use:

githubcontrib --owner USERNAME --repo REPO_NAME --cols 6 --filter user1,user2,user3 | pbcopy

Advanced API

| Parameter name | Description | Default value | Sample value | |--------------------|-------------------------------------------------------------------|----------------------------------------|-------------------------------------| | repo | Repository name. ] | (required) | --repo angular-material | | owner | Repository owner that the repo belongs to. | (required) | --owner angular | | fromDate | YYYY-MM-DD used to determine only the contributors after the specified commit fromDate. | '' | --fromDate 2016-04-01 | | sha | SHA or branch name to start listing commits from. Default == the repository’s default branch (usually master). | '' | --sha e58f3629e | | sortOrder | Specifies the sort order. | 'asc' | --sortOrder desc | | sortBy | Specifies the sort property. It will be passed as third argument to the sortStrategy. | 'contributions' | --sortBy login | | sortStrategy | Custom sort strategy. Built-in strategies support string and number comparison. | '../lib/sort_strategies/sort_asc.js' | --sortStrategy custom_sort.js | | layoutStrategy | Specifies how the output will be formatted. | '../lib/layout_strategies/table.js' | --layoutStrategy custom_layout.js | | filter | Specifies users to be filtered. | [] | --filter userlogin1,userlogin2 | | filterStrategy | Specifies the filter strategy. | '../lib/filter_strategies/login.js' | --filterStrategy custom_filter.js | | authToken | Specifies the scope-limited Github oAuth application token: required increase your request rate limit to 5000 / hour. | '' | --authToken 0da9a3f98dff9a61a0222fd5db201221c5b129f8 |

This way your contributors will be formatted in a table with their photos.

The table strategy accepts the following parameters:

  • image-size - Number - size of the user's avatars
  • format - Enum - MARKDOWN or HTML. Default == HTML
  • showlogin - Boolean, indicates whether the login of the contributor should be shown in the table. Default == false
  • columns-count - Number - number of columns for the table

Different ways of formatting

You can easily add more formatting strategies by exporting the formatting logic.

Here's a sample implementation of a list layout strategy:

var formatter = function (options) {
  options = options || {};
  var field = options.field || 'login',
      numbered = options.style === 'numbers';

  return function (data) {
    var result = '\n';
    data.forEach(function (user, idx) {
      if (numbered) {
        result += idx + 1;
      } else {
        result += '-';
      }
      result += ' ' + user[field] + '\n';
    });
    return result;
  };
};

module.exports = formatter;

Testing with Curl

You can easily use the command line to query for a single page of information from the Github API.

  • Get List of commits for the repository since 4/1/2016:
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: token <accessToken>"  -X GET -d '{"since":"2016-04-01T00:00:00"}' https://api.github.com/repos/<owner>/<repository>/commits  > commits.json
  • Get list of contributors for the repository:
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: token <accessToken>" -X GET https://api.github.com/repos/<owner>/<repository>/contributors  > contributors.json

If, however, you want all the data and the full power... use githubcontrib to get a list of contributors, supports 1..n pages of data, and will format the JSON as Markdown or HTML tables

node githubcontrib --owner angular --repository material --sha master --since 2016-04-01 --cols 6 --sortOrder desc --format md --showlogin true  > ../contributions.md

Bash Function

The following bash function is quite convenient:

function ghcontrib() {
  repo=$(basename $(pwd))
  githubcontrib --owner USER_NAME --repo $repo --cols 6 --showlogin true --filter gitter-badger --sortOrder desc | pbcopy
}

You can invoke it with:

ghcontrib

It assumes that you're in the project's directory, the directory is named after your project on GitHub and your username is USER_NAME.

The function will run githubcontrib and put the returned markdown in your clipboard.

GitHub Limit

The Github API has a 60-requests-per-hour rate-limit for non-authenticated use. If you need some more then a scope-limited Github OAuth token can be used to boost the limit to 5000.

License

MIT