contributor
Version:
A simple module to add git contributors to your package.json.
111 lines (81 loc) • 3.05 kB
Markdown
#Contributor [](https://travis-ci.org/jakeleboeuf/contributor)
A simple module to add git contributors to your package.json. Public repos only for now. Private repos may be possible if I get some time (or if you submit a pull request).
## Install from [npm](https://www.npmjs.org/package/contributor)
$ npm install contributor -g
or add it as one of your projects `package.json` dependencies like
"dependencies": {
"contributor": "0.1.x"
}
## Run
To grab your project contributor's info from your github repo, `cd` into the directory containing your `package.json` and run:
$ contributor
Bingo!
### Behind the scenes
[Contributor](https://www.npmjs.org/package/contributor) hunts for repository.url in your your `package.json`. If it finds a valid repo url, it requests collaborator info from the github api and adds it to your `package.json`. Super simple.
It will make a backup of your original json to `.package.json`, so all your secret codes are safe.
#### Pro tip: Add a git push alias and kill a couple birds.
$ git config alias.pushc \!git push $1 $2 && contributor
This will simply add the pushc alias to your .git/config file like so:
[alias]
pushc = !git push $1 $2 && contributor
Then you can run `git pushc origin master`, and voila! Give it a try on your next project and let me know what you think!
---
###Examle output
####Before `contributor`:
{
"author": "Jake LeBoeuf",
"name": "contributor",
"description": "Example package.json.",
"version": "0.1.0-2",
"homepage": "https://github.com/jakeleboeuf/contributor",
"repository": {
"type": "git",
"url": "https://github.com/jakeleboeuf/contributor.git"
},
"bugs": {
"url": "https://github.com/jakeleboeuf/contributor/issues"
},
"engines": {
"node": "0.10.x",
"npm": "1.4.x"
},
"dependencies": {
"underscore": "1.6.x",
"request": "2.34.x",
"ansi-color": "0.2.x"
}
}
After `contributor`:
{
"author": "Jake LeBoeuf",
"name": "contributor",
"description": "Example package.json.",
"version": "0.1.0-2",
"homepage": "https://github.com/jakeleboeuf/contributor",
"repository": {
"type": "git",
"url": "https://github.com/jakeleboeuf/contributor.git"
},
"bugs": {
"url": "https://github.com/jakeleboeuf/contributor/issues"
},
"engines": {
"node": "0.10.x",
"npm": "1.4.x"
},
"dependencies": {
"underscore": "1.6.x",
"request": "2.34.x",
"ansi-color": "0.2.x"
}
"contributors": [
{
"name": "Jake LeBoeuf",
"email": "dev@jakeleboeuf.com",
"url": "https://github.com/jakeleboeuf",
"contributions": 20,
"hireable": true
}
]
}
[](https://www.gittip.com/jakeleboeuf/)