diff --git a/.all-contributorsrc b/.all-contributorsrc
index 37600e67..eacb57d0 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -71,6 +71,15 @@
"contributions": [
"code"
]
+ },
+ {
+ "login": "kevinjalbert",
+ "name": "Kevin Jalbert",
+ "avatar_url": "https://avatars1.githubusercontent.com/u/574871?v=3",
+ "profile": "https://github.com/kevinjalbert",
+ "contributions": [
+ "code"
+ ]
}
]
}
diff --git a/README.md b/README.md
index e698269b..d2f930c1 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# all-contributors-cli
[![version](https://img.shields.io/npm/v/all-contributors-cli.svg)](http://npm.im/all-contributors-cli)
-[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors)
+[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors)
This is a tool to help automate adding contributor acknowledgements according to the [all-contributors](https://github.com/kentcdodds/all-contributors) specification.
@@ -93,8 +93,9 @@ These are the keys you can specify:
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
-| [
Jeroen Engels](https://github.com/jfmengels)
[π»](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels) [π](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels) [β οΈ](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels) | [
Kent C. Dodds](http://kentcdodds.com/)
[π](https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds) [π»](https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds) | [
JoΓ£o GuimarΓ£es](https://github.com/jccguimaraes)
[π»](https://github.com/jfmengels/all-contributors-cli/commits?author=jccguimaraes) | [
Ben Briggs](http://beneb.info)
[π»](https://github.com/jfmengels/all-contributors-cli/commits?author=ben-eb) | [
Itai Steinherz](https://github.com/itaisteinherz)
[π](https://github.com/jfmengels/all-contributors-cli/commits?author=itaisteinherz) [π»](https://github.com/jfmengels/all-contributors-cli/commits?author=itaisteinherz) | [
Alex Jover](https://github.com/alexjoverm)
[π»](https://github.com/jfmengels/all-contributors-cli/commits?author=alexjoverm) [π](https://github.com/jfmengels/all-contributors-cli/commits?author=alexjoverm) | [
Jerod Santo](https://jerodsanto.net)
[π»](https://github.com/jfmengels/all-contributors-cli/commits?author=jerodsanto) |
+| [
Jeroen Engels](https://github.com/jfmengels)
[π»](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels "Code") [π](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels "Documentation") [β οΈ](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels "Tests") | [
Kent C. Dodds](http://kentcdodds.com/)
[π](https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds "Documentation") [π»](https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds "Code") | [
JoΓ£o GuimarΓ£es](https://github.com/jccguimaraes)
[π»](https://github.com/jfmengels/all-contributors-cli/commits?author=jccguimaraes "Code") | [
Ben Briggs](http://beneb.info)
[π»](https://github.com/jfmengels/all-contributors-cli/commits?author=ben-eb "Code") | [
Itai Steinherz](https://github.com/itaisteinherz)
[π](https://github.com/jfmengels/all-contributors-cli/commits?author=itaisteinherz "Documentation") [π»](https://github.com/jfmengels/all-contributors-cli/commits?author=itaisteinherz "Code") | [
Alex Jover](https://github.com/alexjoverm)
[π»](https://github.com/jfmengels/all-contributors-cli/commits?author=alexjoverm "Code") [π](https://github.com/jfmengels/all-contributors-cli/commits?author=alexjoverm "Documentation") | [
Jerod Santo](https://jerodsanto.net)
[π»](https://github.com/jfmengels/all-contributors-cli/commits?author=jerodsanto "Code") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
+| [
Kevin Jalbert](https://github.com/kevinjalbert)
[π»](https://github.com/jfmengels/all-contributors-cli/commits?author=kevinjalbert "Code") |
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification.
diff --git a/lib/generate/format-contribution-type.js b/lib/generate/format-contribution-type.js
index d4778eb9..c222762a 100644
--- a/lib/generate/format-contribution-type.js
+++ b/lib/generate/format-contribution-type.js
@@ -3,7 +3,7 @@
var _ = require('lodash/fp');
var util = require('../util');
-var linkTemplate = _.template('[<%= symbol %>](<%= url %>)');
+var linkTemplate = _.template('[<%= symbol %>](<%= url %> "<%= description %>")');
function getType(options, contribution) {
var types = util.contributionTypes(options);
@@ -19,15 +19,17 @@ module.exports = function formatContribution(options, contributor, contribution)
var templateData = {
symbol: type.symbol,
+ description: type.description,
contributor: contributor,
options: options
};
+
+ var url = `#${contribution}-${contributor.login}`;
if (contribution.url) {
- return linkTemplate(_.assign({url: contribution.url}, templateData));
- }
- if (type.link) {
- var url = _.template(type.link)(templateData);
- return linkTemplate(_.assign({url: url}, templateData));
+ url = contribution.url;
+ } else if (type.link) {
+ url = _.template(type.link)(templateData);
}
- return type.symbol;
+
+ return linkTemplate(_.assign({url: url}, templateData));
};
diff --git a/lib/generate/format-contribution-type.test.js b/lib/generate/format-contribution-type.test.js
index c3bdd046..1d616de2 100644
--- a/lib/generate/format-contribution-type.test.js
+++ b/lib/generate/format-contribution-type.test.js
@@ -15,24 +15,24 @@ test('should return corresponding symbol', t => {
const contributor = contributors.kentcdodds;
const {options} = fixtures();
- t.is(formatContributionType(options, contributor, 'tool'), 'π§');
- t.is(formatContributionType(options, contributor, 'question'), 'π¬');
+ t.is(formatContributionType(options, contributor, 'tool'), '[π§](#tool-kentcdodds "Tools")');
+ t.is(formatContributionType(options, contributor, 'question'), '[π¬](#question-kentcdodds "Answering Questions")');
});
test('should return link to commits', t => {
const contributor = contributors.kentcdodds;
const {options} = fixtures();
- const expectedLink = '(https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds)';
+ const expectedLink = 'https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds';
- t.is(formatContributionType(options, contributor, 'code'), '[π»]' + expectedLink);
- t.is(formatContributionType(options, contributor, 'doc'), '[π]' + expectedLink);
- t.is(formatContributionType(options, contributor, 'test'), '[β οΈ]' + expectedLink);
+ t.is(formatContributionType(options, contributor, 'code'), '[π»](' + expectedLink + ' "Code")');
+ t.is(formatContributionType(options, contributor, 'doc'), '[π](' + expectedLink + ' "Documentation")');
+ t.is(formatContributionType(options, contributor, 'test'), '[β οΈ](' + expectedLink + ' "Tests")');
});
test('should return link to issues', t => {
const contributor = contributors.kentcdodds;
const {options} = fixtures();
- const expected = '[π](https://github.com/jfmengels/all-contributors-cli/issues?q=author%3Akentcdodds)';
+ const expected = '[π](https://github.com/jfmengels/all-contributors-cli/issues?q=author%3Akentcdodds "Bug reports")';
t.is(formatContributionType(options, contributor, 'bug'), expected);
});
@@ -45,7 +45,7 @@ test('should make any symbol into a link if contribution is an object', t => {
url: 'www.foo.bar'
};
- t.is(formatContributionType(options, contributor, contribution), '[π§](www.foo.bar)');
+ t.is(formatContributionType(options, contributor, contribution), '[π§](www.foo.bar "Tools")');
});
test('should override url for given types', t => {
@@ -56,7 +56,7 @@ test('should override url for given types', t => {
url: 'www.foo.bar'
};
- t.is(formatContributionType(options, contributor, contribution), '[π»](www.foo.bar)');
+ t.is(formatContributionType(options, contributor, contribution), '[π»](www.foo.bar "Code")');
});
test('should be able to add types to the symbol list', t => {
@@ -66,11 +66,11 @@ test('should be able to add types to the symbol list', t => {
cheerful: {symbol: ':smiley:'}
};
- t.is(formatContributionType(options, contributor, 'cheerful'), ':smiley:');
+ t.is(formatContributionType(options, contributor, 'cheerful'), '[:smiley:](#cheerful-kentcdodds "")');
t.is(formatContributionType(options, contributor, {
type: 'cheerful',
url: 'www.foo.bar'
- }), '[:smiley:](www.foo.bar)');
+ }), '[:smiley:](www.foo.bar "")');
});
test('should be able to add types with template to the symbol list', t => {
@@ -83,7 +83,7 @@ test('should be able to add types with template to the symbol list', t => {
}
};
- t.is(formatContributionType(options, contributor, 'web'), '[:web:](www.kentcdodds.com)');
+ t.is(formatContributionType(options, contributor, 'web'), '[:web:](www.kentcdodds.com "")');
});
test('should be able to override existing types', t => {
@@ -93,11 +93,11 @@ test('should be able to override existing types', t => {
code: {symbol: ':smiley:'}
};
- t.is(formatContributionType(options, contributor, 'code'), ':smiley:');
+ t.is(formatContributionType(options, contributor, 'code'), '[:smiley:](#code-kentcdodds "")');
t.is(formatContributionType(options, contributor, {
type: 'code',
url: 'www.foo.bar'
- }), '[:smiley:](www.foo.bar)');
+ }), '[:smiley:](www.foo.bar "")');
});
test('should be able to override existing templates', t => {
@@ -110,11 +110,11 @@ test('should be able to override existing templates', t => {
}
};
- t.is(formatContributionType(options, contributor, 'code'), '[:web:](www.kentcdodds.com)');
+ t.is(formatContributionType(options, contributor, 'code'), '[:web:](www.kentcdodds.com "")');
t.is(formatContributionType(options, contributor, {
type: 'code',
url: 'www.foo.bar'
- }), '[:web:](www.foo.bar)');
+ }), '[:web:](www.foo.bar "")');
});
test('should throw a helpful error on unknown type', t => {
diff --git a/lib/generate/format-contributor.test.js b/lib/generate/format-contributor.test.js
index f9d29a96..3a8c303a 100644
--- a/lib/generate/format-contributor.test.js
+++ b/lib/generate/format-contributor.test.js
@@ -16,7 +16,7 @@ test('should format a simple contributor', t => {
const contributor = _.assign(contributors.kentcdodds, {contributions: ['review']});
const {options} = fixtures();
- const expected = '[
Kent C. Dodds](http://kentcdodds.com)
π';
+ const expected = '[
Kent C. Dodds](http://kentcdodds.com)
[π](#review-kentcdodds "Reviewed Pull Requests")';
t.is(formatContributor(options, contributor), expected);
});
@@ -25,7 +25,7 @@ test('should format contributor with complex contribution types', t => {
const contributor = contributors.kentcdodds;
const {options} = fixtures();
- const expected = '[
Kent C. Dodds](http://kentcdodds.com)
[π](https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds) π π¬';
+ const expected = '[
Kent C. Dodds](http://kentcdodds.com)
[π](https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds "Documentation") [π](#review-kentcdodds "Reviewed Pull Requests") [π¬](#question-kentcdodds "Answering Questions")';
t.is(formatContributor(options, contributor), expected);
});
@@ -45,7 +45,7 @@ test('should default image size to 100', t => {
const {options} = fixtures();
delete options.imageSize;
- const expected = '[
Kent C. Dodds](http://kentcdodds.com)
π';
+ const expected = '[
Kent C. Dodds](http://kentcdodds.com)
[π](#review-kentcdodds "Reviewed Pull Requests")';
t.is(formatContributor(options, contributor), expected);
});
@@ -54,7 +54,7 @@ test('should format contributor with pipes in their name', t => {
const contributor = contributors.pipey;
const {options} = fixtures();
- const expected = '[
Who | Needs | Pipes?](http://github.com/chrisinajar)
[π](https://github.com/jfmengels/all-contributors-cli/commits?author=pipey)';
+ const expected = '[
Who | Needs | Pipes?](http://github.com/chrisinajar)
[π](https://github.com/jfmengels/all-contributors-cli/commits?author=pipey "Documentation")';
t.is(formatContributor(options, contributor), expected);
});