Giter Club home page Giter Club logo

get-contributors.js's Introduction

get-contributors npm

Build Status downloads license

Get contributors from git, and generate a JSON list of contributors or a list base on a user defined template.

  • The contributors is sorted by the contribution of the order.
  • It could show the commits and the percentage contribution in the project.
  • It could add customized fields to output
  • It could use a customized template format to output
  • It could search and assign the github user name from the email address of the contributor.
  • It could ask the user the information of the unknown fields(github etc) at the command line
  • It could write the new contributors to your contributors configuration file(.contributors)
  • It could merge multi-email addresses into one contributor if you've set on your contributors file(".contributors"). the ".contributors" file should be put into the current diretory if no specified position.

Changes

v0.4

  • the percentage contribution in the project should use the changes mainly:
    • contributions = commits*weight.commit(0.618) + insertions + deletions * weight.deletion(0.1)
  • weight option
  • branch option: the git branch to get the contributors.
  • path option: get the contributors of the specified path in the git's working directory

Usage

Usage get-contributors {OPTIONS}

Get contributors from git, and generate
a JSON list of contributors. or a list
base on a user defined template.


Options:
  -d, --dirname         The git project(git working dir) to get contributors. Default: $(pwd)
  -c, --config          The contrbutors configuration file. It uses the CSON format.
                        Default: ${pwd}/.contributors
  -b, --branch          get the contributors on the git branch.
                        Default: current branch(HEAD).
      --path            get the contributors on the specified path in the git's working directory.
                        Default: root dir(all).
  -g, --tryGithub       try to get the github user name from the email via Search the github.
                        Default: yes, --no-tryGithub to disable it.
  -p, --weight          the commits and deletion weight of contribution:
                        It means the weight of commits if it's a number.
                        Default: "commit:0.618,deletion:0.1".
  -w, --write           Write the contrbutors configuration file if it has new contrbutors comming.
                        Default: yes, --no-write to disable it.
  -e, --fields          The output fields name, separate via comma. Default: "name,github"
                        * name: the user name
                        * email: the user email address
                          the user can have many emails, see contributors configuration.
                        * github: the github user name(it could be used as a user id)
                        * commits: the commits count of this contributor
                        * percent: the percentage with the contribution
  -f, --format          The output format, the customized template, cson or json, Default: json
                        * template: the customized template via user
                        * json: the json format
                        * cson: the cson format
  -a, --ask             whether ask the user to input if it can not find the field(github,etc).
                        Default: yes, --no-ask to disable it.
  -t, --template        The template for the template format. It supports the simple template and
                        the complex template. the complex template has three parts, head template,
                        body template and tail template, the head and tail could be ignore. (you
                        should define this in the configuration file only)
                        Default:
                        <% _.forEach(contributors, function(contributor) {
                             var item = contributor.name
                             if (contributor.github)
                               item = "[" + item +"](https://github.com/" + contributor.github
                             print(" * " + item)
                           }
                        %>
                        Complex template(in the congfiguration file) example:
                        template: [
                        	'''
                        		| Contributor Name | Github |
                        		| ---------------  | ------ |

                        	'''
                        	'''
                        		| ${contributor.name} | ${contributor.github} |

                        	'''
                        ]
  -i, --info            Show configuration infomation.
  -h, --help            Show this help infomation.

The contributors configuration file(cson format):

dirname: '.'
tryGithub: false
write: false
fields: 'name,github'
template: [
	'''
		| Contributor Name | Github |
		| ---------------  | ------ |

	'''
	'''
		| ${contributor.name} | ${contributor.github ? "[" + contributor.github + "](https://github.com/" + contributor.github + ")" : "-"} |

	'''
]
users:
  Jame:
    name: 'Jame Smith'
    email: '[email protected]'
    github: 'jame'
    twitter: 'jame'
    url: 'https://www.xxx.com'
  Mike:
    name: 'Mike Smith'
    email: ['[email protected]', '[email protected]']
    github: 'mike'
    twitter: 'mike'

License

MIT

get-contributors.js's People

Contributors

snowyu avatar

Stargazers

Mikey avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.