Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Bump inquirer to v3 and promisify everything (#34)
BREAKING CHANGE: Drop support for Node < v4. This uses native Promises available from Node v4. * fix: Bump inquirer to v3.0.1. Fixes #33 to improve Windows support. * refactor: Promisify everything as inquirer uses Promises from 1.0.0 onwards
- Loading branch information
Showing
14 changed files
with
164 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
'use strict'; | ||
|
||
var request = require('request'); | ||
var pify = require('pify'); | ||
var request = pify(require('request')); | ||
|
||
module.exports = function getUserInfo(username, cb) { | ||
request.get({ | ||
module.exports = function getUserInfo(username) { | ||
return request.get({ | ||
url: 'https://api.github.com/users/' + username, | ||
headers: { | ||
'User-Agent': 'request' | ||
} | ||
}, function (error, res) { | ||
if (error) { | ||
return cb(error); | ||
} | ||
}) | ||
.then(res => { | ||
var body = JSON.parse(res.body); | ||
var user = { | ||
return { | ||
login: body.login, | ||
name: body.name || username, | ||
avatar_url: body.avatar_url, | ||
profile: body.blog || body.html_url | ||
}; | ||
return cb(null, user); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.