updater-contributors
Advanced tools
Comparing version 0.1.0 to 0.1.2
{ | ||
"name": "updater-contributors", | ||
"description": "Update the contributors array in package.json with the contributors returned by the GitHub API.", | ||
"version": "0.1.0", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/update/updater-contributors", | ||
@@ -25,5 +25,5 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"dependencies": { | ||
"async-array-reduce": "^0.2.0", | ||
"github-base": "^0.4.1", | ||
"github-contributors": "^0.3.0", | ||
"async-each": "^1.0.1", | ||
"github-base": "^0.5.1", | ||
"github-contributors": "^0.4.0", | ||
"stringify-author": "^0.1.3" | ||
@@ -52,3 +52,3 @@ }, | ||
"toc": false, | ||
"layout": "default", | ||
"layout": "global", | ||
"tasks": [ | ||
@@ -75,2 +75,2 @@ "readme" | ||
} | ||
} | ||
} |
@@ -7,6 +7,6 @@ # updater-contributors [![NPM version](https://img.shields.io/npm/v/updater-contributors.svg?style=flat)](https://www.npmjs.com/package/updater-contributors) [![NPM downloads](https://img.shields.io/npm/dm/updater-contributors.svg?style=flat)](https://npmjs.org/package/updater-contributors) | ||
Install with [npm](https://www.npmjs.com/): | ||
Install globally with [npm](https://www.npmjs.com/) | ||
```sh | ||
$ npm install --save updater-contributors | ||
$ npm install --global updater-contributors | ||
``` | ||
@@ -20,2 +20,29 @@ | ||
## Help | ||
Common [update](https://github.com/update/update) commands. | ||
```console | ||
Usage: update <command> [options] | ||
Command: updater or tasks to run | ||
Options: | ||
--config, -c Save a configuration value to the `update` object in package.json | ||
--cwd Set or display the current working directory | ||
--help, -h Display this help menu | ||
--init, -i Prompts you to specify default updaters to run | ||
--run Force updaters/tasks to run regardless of other flags used | ||
--silent, -S Silence all tasks and updaters in the terminal | ||
--version, -V Display the current version of update | ||
--verbose, -v Display all verbose logging messages | ||
``` | ||
If this is the first time you've used [update](https://github.com/update/update), run the following command to add this updater to your default updaters: | ||
```sh | ||
$ update init | ||
``` | ||
## About | ||
@@ -64,2 +91,2 @@ | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.30, on August 31, 2016._ | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.30, on September 10, 2016._ |
'use strict'; | ||
var each = require('async-each'); | ||
var contributors = require('github-contributors'); | ||
var stringify = require('stringify-author'); | ||
var reduce = require('async-array-reduce'); | ||
var GitHub = require('github-base'); | ||
@@ -10,6 +10,11 @@ | ||
var github; | ||
var auth; | ||
app.task('authenticate', function(cb) { | ||
github = new GitHub(); | ||
// todo | ||
auth = { | ||
username: app.options.username || app.options.u, | ||
password: app.options.password || app.options.p | ||
}; | ||
github = new GitHub(auth); | ||
cb(); | ||
@@ -21,12 +26,13 @@ }); | ||
contributors(data.repo, function(err, arr) { | ||
contributors(data.repo, auth, function(err, arr) { | ||
if (err) return cb(err); | ||
if (!Array.isArray(arr) || arr.length === 1) { | ||
if (!Array.isArray(arr) || arr.length <= 1) { | ||
cb(); | ||
return; | ||
} | ||
users(arr, function(err, res) { | ||
users(arr, function(err, contributors) { | ||
if (err) return cb(err); | ||
app.pkg.set('contributors', res); | ||
app.pkg.set('contributors', contributors); | ||
app.pkg.save(); | ||
@@ -39,12 +45,18 @@ cb(); | ||
function users(arr, cb) { | ||
reduce(arr, [], function(acc, user, next) { | ||
github.get(`/users/${user.login}`, function(err, res) { | ||
var acc = []; | ||
each(arr, function(user, next) { | ||
if (!user || !user.login) { | ||
next(null, acc); | ||
return; | ||
} | ||
github.get('/users/' + user.login, function(err, res) { | ||
if (err) return next(err); | ||
var contributor = {name: res.name}; | ||
var url = res.blog || res.html_url | ||
var email = res.email; | ||
if (email) contributor.email = email; | ||
var contributor = { name: res.name }; | ||
var url = res.blog || res.html_url; | ||
if (res.email) contributor.email = res.email; | ||
if (url) contributor.url = url; | ||
acc.push(stringify(contributor)); | ||
next(null, acc); | ||
next(null, stringify(contributor)); | ||
}); | ||
@@ -54,2 +66,1 @@ }, cb); | ||
}; | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7313
51
89
+ Addedasync-each@^1.0.1
+ Addedasync-each@1.0.6(transitive)
+ Addedcopy-descriptor@0.1.1(transitive)
+ Addeddecompress-response@3.3.0(transitive)
+ Addedformat-people@0.1.4(transitive)
+ Addedgithub-base@0.5.4(transitive)
+ Addedgithub-contributors@0.4.1(transitive)
+ Addedmimic-response@1.0.1(transitive)
+ Addedobject-copy@0.1.0(transitive)
+ Addedsimple-concat@1.0.1(transitive)
+ Addedsimple-get@2.8.2(transitive)
+ Addedstatic-extend@0.1.2(transitive)
+ Addeduse@3.1.1(transitive)
- Removedasync-array-reduce@^0.2.0
- Removedasync-array-reduce@0.2.1(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedclone-deep@0.2.4(transitive)
- Removedconcat-stream@1.6.2(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddelegate-properties@0.3.0(transitive)
- Removedfor-in@0.1.8(transitive)
- Removedgithub-base@0.4.1(transitive)
- Removedgithub-contributors@0.3.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedkind-of@2.0.1(transitive)
- Removedlazy-cache@0.2.71.0.4(transitive)
- Removedmixin-object@2.0.1(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedshallow-clone@0.1.2(transitive)
- Removedsimple-get@1.4.3(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedtypedarray@0.0.6(transitive)
- Removedunzip-response@1.0.2(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updatedgithub-base@^0.5.1
Updatedgithub-contributors@^0.4.0