git-contributors

A nodejs module providing contribution stats for your git repository

A Node.js module providing contribution stats for your git repository.

This module utilize $ git log --pretty=%an to calculate and add the amount of percental contribution of each committer to the output.

_Note:_
Please be aware that the current checked out branch is inspected. Currently there is no way to specify a custom branch.

$ npm install -g git-contributors
$ git-contributors.js --help
$ git-contributors.js [options] /path/to/repository-dir/

You can also require it somewhere in your node-module,

// your-node-module.js 
var GitContributors = require('git-contributors').GitContributors;
 
var opts = '/path/to/repository-dir'; // or 
    opts = {cwd: '/path/to/repository-dir', format: 'json'};
 
GitContributors.list(opts, function (errresult) {
    if (err) { throw err; }
    console.log(JSON.stringify(result, null, 2));
});

.. which gives you an sorted array of results:

[
  // sorted descending by commits (beautyfied) 
  { commits: 200, name: 'Maja',  email: 'maja@hive', percent: 76.9 },
  { commits: 50,  name: 'Flip',  email: 'flip@meadow', percent: 19.2 },
  { commits: 10,  name: 'Willi', email: 'willi@sunflower', percent: 3.8 }
]
$ node --version # 10.28+ 
$ git --version # 1.7+ 
$ npm test
// or
$ grunt test
// or
$ mocha -R list

(The MIT License)

Copyright (c) 2014 David Linse davidlinse@gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THEWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.