diff --git a/.all-contributorsrc b/.all-contributorsrc index 186c870..c68dbcd 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -490,6 +490,13 @@ "avatar_url": "https://avatars.githubusercontent.com/u/6765735?v=4", "profile": "https://github.com/schweden1997", "contributions": ["bug"] + }, + { + "login": "KibbeWater", + "name": "Snow", + "avatar_url": "https://avatars.githubusercontent.com/u/35224538?v=4", + "profile": "https://kibbewater.com", + "contributions": ["code", "bug"] } ], "skipCi": true, diff --git a/src/generate/__tests__/format-contributor.js b/src/generate/__tests__/format-contributor.js index e9ebde8..412d1bc 100644 --- a/src/generate/__tests__/format-contributor.js +++ b/src/generate/__tests__/format-contributor.js @@ -20,7 +20,7 @@ test('format a simple contributor', () => { const {options} = fixtures() const expected = - 'Kent C. Dodds
Kent C. Dodds

👀' + 'Kent C. Dodds
Kent C. Dodds

👀' expect(formatContributor(options, contributor)).toBe(expected) }) @@ -30,7 +30,7 @@ test('format contributor with complex contribution types', () => { const {options} = fixtures() const expected = - 'Kent C. Dodds
Kent C. Dodds

📖 👀 💬' + 'Kent C. Dodds
Kent C. Dodds

📖 👀 💬' expect(formatContributor(options, contributor)).toBe(expected) }) @@ -53,7 +53,7 @@ test('default image size to 100', () => { delete options.imageSize const expected = - 'Kent C. Dodds
Kent C. Dodds

👀' + 'Kent C. Dodds
Kent C. Dodds

👀' expect(formatContributor(options, contributor)).toBe(expected) }) @@ -63,7 +63,7 @@ test('format contributor with pipes in their name', () => { const {options} = fixtures() const expected = - 'Who | Needs | Pipes?
Who | Needs | Pipes?

📖' + 'Who | Needs | Pipes?
Who | Needs | Pipes?

📖' expect(formatContributor(options, contributor)).toBe(expected) }) @@ -73,7 +73,7 @@ test('format contributor with no GitHub account', () => { const {options} = fixtures() const expected = - 'No Github Account
No Github Account
🌍' + 'No Github Account
No Github Account
🌍' expect(formatContributor(options, contributor)).toBe(expected) }) @@ -83,7 +83,7 @@ test('format contributor with no complete name', () => { const {options} = fixtures() const expected = - 'nocompletename
nocompletename
🌍' + 'nocompletename
nocompletename
🌍' expect(formatContributor(options, contributor)).toBe(expected) }) @@ -93,6 +93,6 @@ test('format contributor with quotes in name', () => { const {options} = fixtures() const expected = - 'Name "Nickname" Lastname
Name "Nickname" Lastname

📖' + 'Name "Nickname" Lastname
Name "Nickname" Lastname

📖' expect(formatContributor(options, contributor)).toBe(expected) }) diff --git a/src/generate/format-contributor.js b/src/generate/format-contributor.js index 5a86e83..c4adff8 100644 --- a/src/generate/format-contributor.js +++ b/src/generate/format-contributor.js @@ -2,7 +2,7 @@ const _ = require('lodash/fp') const formatContributionType = require('./format-contribution-type') const avatarTemplate = _.template( - '<%= name %>', + '<%= name %>', ) const avatarBlockTemplate = _.template( '<%= avatar %>
<%= name %>
', @@ -52,9 +52,19 @@ function escapeName(name) { module.exports = function formatContributor(options, contributor) { const formatter = _.partial(formatContributionType, [options, contributor]) const contributions = contributor.contributions.map(formatter).join(' ') + + const contributorAvatarUrl = new URL(contributor.avatar_url) + contributorAvatarUrl.searchParams.append( + 'size', + options.imageSize ?? defaultImageSize, + ) + const templateData = { contributions, - contributor, + contributor: { + ...contributor, + avatar_url: contributorAvatarUrl.toString(), + }, options: _.assign({imageSize: defaultImageSize}, options), } const customTemplate =