mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 21:46:29 +00:00
Use contributor\'s blog as profile link if available
This commit is contained in:
parent
f9979731fb
commit
a973379bd5
5 changed files with 20 additions and 14 deletions
|
@ -7,7 +7,7 @@
|
||||||
"login": "jfmengels"
|
"login": "jfmengels"
|
||||||
, "name": "Jeroen Engels"
|
, "name": "Jeroen Engels"
|
||||||
, "avatar_url": "https://avatars.githubusercontent.com/u/3869412?v=3"
|
, "avatar_url": "https://avatars.githubusercontent.com/u/3869412?v=3"
|
||||||
, "html_url": "https://github.com/jfmengels"
|
, "profile": "https://github.com/jfmengels"
|
||||||
, "contributions": [
|
, "contributions": [
|
||||||
"code"
|
"code"
|
||||||
, "doc"
|
, "doc"
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
"login": "kentcdodds"
|
"login": "kentcdodds"
|
||||||
, "name": "Kent C. Dodds"
|
, "name": "Kent C. Dodds"
|
||||||
, "avatar_url": "https://avatars.githubusercontent.com/u/1500684?v=3"
|
, "avatar_url": "https://avatars.githubusercontent.com/u/1500684?v=3"
|
||||||
, "html_url": "http://kentcdodds.com/"
|
, "profile": "http://kentcdodds.com/"
|
||||||
, "contributions": [
|
, "contributions": [
|
||||||
"doc"
|
"doc"
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,7 +6,7 @@ function mockInfoFetcher(username, cb) {
|
||||||
login: username,
|
login: username,
|
||||||
name: 'Some name',
|
name: 'Some name',
|
||||||
avatar_url: 'www.avatar.url',
|
avatar_url: 'www.avatar.url',
|
||||||
html_url: 'www.html.url'
|
profile: 'www.profile.url'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ function fixtures() {
|
||||||
login: 'login1',
|
login: 'login1',
|
||||||
name: 'Some name',
|
name: 'Some name',
|
||||||
avatar_url: 'www.avatar.url',
|
avatar_url: 'www.avatar.url',
|
||||||
html_url: 'www.html.url',
|
profile: 'www.profile.url',
|
||||||
contributions: [
|
contributions: [
|
||||||
'code'
|
'code'
|
||||||
]
|
]
|
||||||
|
@ -24,7 +24,7 @@ function fixtures() {
|
||||||
login: 'login2',
|
login: 'login2',
|
||||||
name: 'Some name',
|
name: 'Some name',
|
||||||
avatar_url: 'www.avatar.url',
|
avatar_url: 'www.avatar.url',
|
||||||
html_url: 'www.html.url',
|
profile: 'www.profile.url',
|
||||||
contributions: [
|
contributions: [
|
||||||
{ type: 'blog', url: 'www.blog.url/path' },
|
{ type: 'blog', url: 'www.blog.url/path' },
|
||||||
'code'
|
'code'
|
||||||
|
@ -60,7 +60,7 @@ test.cb('should add new contributor at the end of the list of contributors', t =
|
||||||
login: 'login3',
|
login: 'login3',
|
||||||
name: 'Some name',
|
name: 'Some name',
|
||||||
avatar_url: 'www.avatar.url',
|
avatar_url: 'www.avatar.url',
|
||||||
html_url: 'www.html.url',
|
profile: 'www.profile.url',
|
||||||
contributions: [
|
contributions: [
|
||||||
'doc'
|
'doc'
|
||||||
]
|
]
|
||||||
|
@ -82,7 +82,7 @@ test.cb('should add new contributor at the end of the list of contributors with
|
||||||
login: 'login3',
|
login: 'login3',
|
||||||
name: 'Some name',
|
name: 'Some name',
|
||||||
avatar_url: 'www.avatar.url',
|
avatar_url: 'www.avatar.url',
|
||||||
html_url: 'www.html.url',
|
profile: 'www.profile.url',
|
||||||
contributions: [
|
contributions: [
|
||||||
{ type: 'doc', url: 'www.foo.bar' }
|
{ type: 'doc', url: 'www.foo.bar' }
|
||||||
]
|
]
|
||||||
|
@ -115,7 +115,7 @@ test.cb(`should update an existing contributor's contributions if a new type is
|
||||||
login: 'login1',
|
login: 'login1',
|
||||||
name: 'Some name',
|
name: 'Some name',
|
||||||
avatar_url: 'www.avatar.url',
|
avatar_url: 'www.avatar.url',
|
||||||
html_url: 'www.html.url',
|
profile: 'www.profile.url',
|
||||||
contributions: [
|
contributions: [
|
||||||
'code',
|
'code',
|
||||||
'bug'
|
'bug'
|
||||||
|
@ -138,7 +138,7 @@ test.cb(`should update an existing contributor's contributions if a new type is
|
||||||
login: 'login1',
|
login: 'login1',
|
||||||
name: 'Some name',
|
name: 'Some name',
|
||||||
avatar_url: 'www.avatar.url',
|
avatar_url: 'www.avatar.url',
|
||||||
html_url: 'www.html.url',
|
profile: 'www.profile.url',
|
||||||
contributions: [
|
contributions: [
|
||||||
'code',
|
'code',
|
||||||
{ type: 'bug', url: 'www.foo.bar' },
|
{ type: 'bug', url: 'www.foo.bar' },
|
||||||
|
|
|
@ -13,7 +13,13 @@ module.exports = function getUserInfo(username, cb) {
|
||||||
if (error) {
|
if (error) {
|
||||||
return cb(error);
|
return cb(error);
|
||||||
}
|
}
|
||||||
var user = JSON.parse(res.body);
|
var body = JSON.parse(res.body);
|
||||||
return cb(null, _.pick(['login', 'name', 'avatar_url', 'html_url'], user));
|
var user = {
|
||||||
|
login: body.login,
|
||||||
|
name: body.name,
|
||||||
|
avatar_url: body.avatar_url,
|
||||||
|
profile: body.blog || body.html_url
|
||||||
|
};
|
||||||
|
return cb(null, user);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"kentcdodds": {
|
"kentcdodds": {
|
||||||
"login": "kentcdodds",
|
"login": "kentcdodds",
|
||||||
"name": "Kent C. Dodds",
|
"name": "Kent C. Dodds",
|
||||||
"html_url": "http://kentcdodds.com",
|
"profile": "http://kentcdodds.com",
|
||||||
"avatar_url": "https://avatars1.githubusercontent.com/u/1500684",
|
"avatar_url": "https://avatars1.githubusercontent.com/u/1500684",
|
||||||
"contributions": [
|
"contributions": [
|
||||||
"doc",
|
"doc",
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
"bogas04": {
|
"bogas04": {
|
||||||
"login": "bogas04",
|
"login": "bogas04",
|
||||||
"name": "Divjot Singh",
|
"name": "Divjot Singh",
|
||||||
"html_url": "http://bogas04.github.io",
|
"profile": "http://bogas04.github.io",
|
||||||
"avatar_url": "https://avatars1.githubusercontent.com/u/6177621",
|
"avatar_url": "https://avatars1.githubusercontent.com/u/6177621",
|
||||||
"contributions": [
|
"contributions": [
|
||||||
"review"
|
"review"
|
||||||
|
|
|
@ -5,7 +5,7 @@ var _ = require('lodash/fp');
|
||||||
var formatContributionType = require('./formatContributionType');
|
var formatContributionType = require('./formatContributionType');
|
||||||
|
|
||||||
var avatarTemplate = _.template('![<%= contributor.name %>](<%= contributor.avatar_url %>)');
|
var avatarTemplate = _.template('![<%= contributor.name %>](<%= contributor.avatar_url %>)');
|
||||||
var avatarBlockTemplate = _.template('[<%= avatar %><br /><sub><%= contributor.name %></sub>](<%= contributor.html_url %>)');
|
var avatarBlockTemplate = _.template('[<%= avatar %><br /><sub><%= contributor.name %></sub>](<%= contributor.profile %>)');
|
||||||
var contributorTemplate = _.template('<%= avatarBlock %><br /><%= contributions %>');
|
var contributorTemplate = _.template('<%= avatarBlock %><br /><%= contributions %>');
|
||||||
|
|
||||||
function defaultTemplate(templateData) {
|
function defaultTemplate(templateData) {
|
||||||
|
|
Loading…
Reference in a new issue