From e9c1f55beb2c18391a5d5f0c9e8243dc3f89ebe3 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sun, 14 Feb 2021 08:21:21 +0000 Subject: [PATCH 01/28] docs: add SirWindfield as a contributor (#297) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 ++++ README.md | 116 ++++++++++++++++++++++---------------------- 2 files changed, 68 insertions(+), 57 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 54be8e19..56a9bdd7 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -549,6 +549,15 @@ "contributions": [ "code" ] + }, + { + "login": "SirWindfield", + "name": "SirWindfield", + "avatar_url": "https://avatars.githubusercontent.com/u/5113257?v=4", + "profile": "https://github.com/SirWindfield", + "contributions": [ + "code" + ] } ], "skipCi": true diff --git a/README.md b/README.md index 48cb0bd5..4e3eaa53 100644 --- a/README.md +++ b/README.md @@ -80,85 +80,87 @@ Thanks goes to these wonderful people - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - + + +

Jeroen Engels

πŸ’» πŸ“– ⚠️

Kent C. Dodds

πŸ“– πŸ’»

JoΓ£o GuimarΓ£es

πŸ’»

Ben Briggs

πŸ’»

Itai Steinherz

πŸ“– πŸ’»

Alex Jover

πŸ’» πŸ“–

Jeroen Engels

πŸ’» πŸ“– ⚠️

Kent C. Dodds

πŸ“– πŸ’»

JoΓ£o GuimarΓ£es

πŸ’»

Ben Briggs

πŸ’»

Itai Steinherz

πŸ“– πŸ’»

Alex Jover

πŸ’» πŸ“–

Jerod Santo

πŸ’»

Kevin Jalbert

πŸ’»

tunnckoCore

πŸ”§

Mehdi Achour

πŸ’»

Roy Revelt

πŸ›

Chris Vickery

πŸ’»

Jerod Santo

πŸ’»

Kevin Jalbert

πŸ’»

tunnckoCore

πŸ”§

Mehdi Achour

πŸ’»

Roy Revelt

πŸ›

Chris Vickery

πŸ’»

Bryce Reynolds

πŸ’»

James, please

πŸ€” πŸ’»

Spyros Ioakeimidis

πŸ’»

Fernando Costa

πŸ’»

snipe

πŸ“–

Gant Laborde

πŸ’»

Bryce Reynolds

πŸ’»

James, please

πŸ€” πŸ’»

Spyros Ioakeimidis

πŸ’»

Fernando Costa

πŸ’»

snipe

πŸ“–

Gant Laborde

πŸ’»

Md Zubair Ahmed

πŸ“– πŸ› πŸ’» ⚠️

Divjot Singh

πŸ“–

JoΓ£o Marques

πŸ’» πŸ“– πŸ€”

Andrew Lisowski

πŸ’» πŸ“– ⚠️

Xianming Zhong

πŸ“–

C.Y.Xu

πŸ’»

Md Zubair Ahmed

πŸ“– πŸ› πŸ’» ⚠️

Divjot Singh

πŸ“–

JoΓ£o Marques

πŸ’» πŸ“– πŸ€”

Andrew Lisowski

πŸ’» πŸ“– ⚠️

Xianming Zhong

πŸ“–

C.Y.Xu

πŸ’»

Dura

πŸ“–

Jake Bolam

πŸš‡ πŸ’» πŸ“– ⚠️ πŸ‘€ πŸ’¬

Maximilian Berkmann

πŸ’» ⚠️ πŸ“– πŸ”§ 🚧 πŸ‘€ πŸ’¬

tbenning

🎨

ehmicky

πŸ’»

James George

πŸ’»

Dura

πŸ“–

Jake Bolam

πŸš‡ πŸ’» πŸ“– ⚠️ πŸ‘€ πŸ’¬

Maximilian Berkmann

πŸ’» ⚠️ πŸ“– πŸ”§ 🚧 πŸ‘€ πŸ’¬

tbenning

🎨

ehmicky

πŸ’»

James George

πŸ’»

Nick Schonning

πŸ’»

Cezar Augusto

πŸ“–

Jeppe Reinhold

πŸ’»

Rachel M. Carmena

πŸ’»

simon3000

⚠️

SnOβ‚‚WMaN

πŸ’»

Nick Schonning

πŸ’»

Cezar Augusto

πŸ“–

Jeppe Reinhold

πŸ’»

Rachel M. Carmena

πŸ’»

simon3000

⚠️

SnOβ‚‚WMaN

πŸ’»

Fabrizio

πŸ› πŸ’»

kharaone

πŸ’»

Marcelo Alves

πŸ’» ⚠️

Anand Chowdhary

⚠️ πŸ› πŸ’»

Nicolas Goutay

πŸ’»

Tyler Krupicka

πŸ’» ⚠️

Fabrizio

πŸ› πŸ’»

kharaone

πŸ’»

Marcelo Alves

πŸ’» ⚠️

Anand Chowdhary

⚠️ πŸ› πŸ’»

Nicolas Goutay

πŸ’»

Tyler Krupicka

πŸ’» ⚠️

Stefano Moia

πŸ’»

IlaΓ― Deutel

πŸ“¦

Justin Dalrymple

πŸ’»

Piotr StΔ™pniewski

πŸ› πŸ’» ⚠️

Gregor Martynus

πŸ‘€ πŸ’¬

Jeff Wen

πŸ‘€

Stefano Moia

πŸ’»

IlaΓ― Deutel

πŸ“¦

Justin Dalrymple

πŸ’»

Piotr StΔ™pniewski

πŸ› πŸ’» ⚠️

Gregor Martynus

πŸ‘€ πŸ’¬

Jeff Wen

πŸ‘€

PaweΕ‚ Kowalski

πŸ’»

Markus LΓΆning

πŸ’»

David Anson

πŸ›

Jeroen Claassens

πŸ’»

Erek Speed

πŸ’»

Shai Reznik

πŸ› πŸ’» ⚠️

PaweΕ‚ Kowalski

πŸ’»

Markus LΓΆning

πŸ’»

David Anson

πŸ›

Jeroen Claassens

πŸ’»

Erek Speed

πŸ’»

Shai Reznik

πŸ› πŸ’» ⚠️

Darek Kay

πŸ’» ⚠️

LaChapeliere

πŸ’»

Darek Kay

πŸ’» ⚠️

LaChapeliere

πŸ’»

SirWindfield

πŸ’»
- + + This project follows the From 4be9bffe31f26302268471e38ec04d0330e05d20 Mon Sep 17 00:00:00 2001 From: G r e y Date: Fri, 14 May 2021 14:06:40 -0500 Subject: [PATCH 02/28] chore(deps): CVE-2021-23337 in inquirer->lodash (#303) Resolves: #302 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1f2364dd..68be55a9 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "async": "^3.0.1", "chalk": "^4.0.0", "didyoumean": "^1.2.1", - "inquirer": "^7.0.4", + "inquirer": "^7.3.3", "json-fixer": "^1.5.1", "lodash": "^4.11.2", "node-fetch": "^2.6.0", From f1a336d9f3e4a63c6ce69752ffa61d67e308fa4d Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 14 May 2021 20:13:11 +0100 Subject: [PATCH 03/28] docs: add vapurrmaid as a contributor (#304) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * docs(config): update .all-contributorsrc * docs(readme): update README.md Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Maximilian Berkmann --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 56a9bdd7..4856b698 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -558,6 +558,15 @@ "contributions": [ "code" ] + }, + { + "login": "vapurrmaid", + "name": "G r e y", + "avatar_url": "https://avatars.githubusercontent.com/u/11184711?v=4", + "profile": "https://vapurrmaid.ca", + "contributions": [ + "security" + ] } ], "skipCi": true diff --git a/README.md b/README.md index 4e3eaa53..ff03185e 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,7 @@ Thanks goes to these wonderful people
Darek Kay

πŸ’» ⚠️
LaChapeliere

πŸ’»
SirWindfield

πŸ’» +
G r e y

πŸ›‘οΈ From d3b8f8889db7fe44e678e1da2395b1ede41807ad Mon Sep 17 00:00:00 2001 From: Lucas Cimon <925560+Lucas-C@users.noreply.github.com> Date: Mon, 29 Nov 2021 23:51:02 +0100 Subject: [PATCH 04/28] fix: scriptName + improving usage messages (#305) * Improving usage messages + fixing scriptName * Fixes post-review --- other/MAINTAINING.md | 8 ++++---- src/cli.js | 14 +++++--------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/other/MAINTAINING.md b/other/MAINTAINING.md index 5232261b..a31d2adf 100644 --- a/other/MAINTAINING.md +++ b/other/MAINTAINING.md @@ -41,8 +41,8 @@ as you want/need to. Nobody can ask any more of you than that. As a maintainer, you're fine to make your branches on the main repo or on your own fork. Either way is fine. -When we receive a pull request, a travis build is kicked off automatically (see the `.travis.yml` -for what runs in the travis build). We avoid merging anything that breaks the travis build. +When we receive a pull request, a Circle CI build is kicked off automatically (see the `.circleci/` +directory for what runs in the CI pipeline). We avoid merging anything that breaks the CI pipeline. Please review PRs and focus on the code rather than the individual. You never know when this is someone's first ever PR and we want their experience to be as positive as possible, so be @@ -56,8 +56,8 @@ about that. ## Release -Our releases are automatic. They happen whenever code lands into `master`. A travis build gets -kicked off and if it's successful, a tool called +Our releases are automatic. They happen whenever code lands into `master`. A Circle CI build +build gets kicked off and if it's successful, a tool called [`semantic-release`](https://github.com/semantic-release/semantic-release) is used to automatically publish a new release to npm as well as a changelog to GitHub. It is only able to determine the version and whether a release is necessary by the git commit messages. With this diff --git a/src/cli.js b/src/cli.js index 4d356819..7be588ec 100755 --- a/src/cli.js +++ b/src/cli.js @@ -16,22 +16,18 @@ const cwd = process.cwd() const defaultRCFile = path.join(cwd, '.all-contributorsrc') const yargv = yargs + .scriptName('all-contributors') .help('help') .alias('h', 'help') .alias('v', 'version') .version() .recommendCommands() - .command('generate', 'Generate the list of contributors') - .usage('Usage: $0 generate') - .command('add', 'add a new contributor') - .usage('Usage: $0 add ') - .command('init', 'Prepare the project to be used with this tool') - .usage('Usage: $0 init') + .command('generate', `Generate the list of contributors\n\nUSAGE: all-contributors generate`) + .command('add', `Add a new contributor\n\nUSAGE: all-contributors add `) + .command('init', `Prepare the project to be used with this tool\n\nUSAGE: all-contributors init`) .command( 'check', - 'Compares contributors from the repository with the ones credited in .all-contributorsrc', - ) - .usage('Usage: $0 check') + `Compare contributors from the repository with the ones credited in .all-contributorsrc'\n\nUSAGE: all-contributors check`) .boolean('commit') .default('files', ['README.md']) .default('contributorsPerLine', 7) From 5dbb7213b08a7badc6a357b2af719c2c5daef9a3 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 30 Nov 2021 09:43:56 -0800 Subject: [PATCH 05/28] docs: add Lucas-C as a contributor for doc (#306) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 11 ++++- README.md | 109 ++++++++++++++++++++++---------------------- 2 files changed, 65 insertions(+), 55 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 4856b698..afe1e39a 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1,6 +1,6 @@ { "projectOwner": "all-contributors", - "projectName": "all-contributors-cli", + "projectName": "cli", "imageSize": 100, "repoType": "github", "commit": false, @@ -567,6 +567,15 @@ "contributions": [ "security" ] + }, + { + "login": "Lucas-C", + "name": "Lucas Cimon", + "avatar_url": "https://avatars.githubusercontent.com/u/925560?v=4", + "profile": "https://chezsoi.org/lucas/blog/", + "contributions": [ + "doc" + ] } ], "skipCi": true diff --git a/README.md b/README.md index ff03185e..1eae84d9 100644 --- a/README.md +++ b/README.md @@ -80,82 +80,83 @@ Thanks goes to these wonderful people - - - - - - + + + + + + - - + + - - - + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - + + + - - + + - - - - - - + + + + + + - - - - - - + + + + + + - + - - - - + + + + - - - - - - + + + + + + - - - + + + +

Jeroen Engels

πŸ’» πŸ“– ⚠️

Kent C. Dodds

πŸ“– πŸ’»

JoΓ£o GuimarΓ£es

πŸ’»

Ben Briggs

πŸ’»

Itai Steinherz

πŸ“– πŸ’»

Alex Jover

πŸ’» πŸ“–

Jeroen Engels

πŸ’» πŸ“– ⚠️

Kent C. Dodds

πŸ“– πŸ’»

JoΓ£o GuimarΓ£es

πŸ’»

Ben Briggs

πŸ’»

Itai Steinherz

πŸ“– πŸ’»

Alex Jover

πŸ’» πŸ“–

Jerod Santo

πŸ’»

Kevin Jalbert

πŸ’»

Jerod Santo

πŸ’»

Kevin Jalbert

πŸ’»

tunnckoCore

πŸ”§

Mehdi Achour

πŸ’»

Roy Revelt

πŸ›

Chris Vickery

πŸ’»

Mehdi Achour

πŸ’»

Roy Revelt

πŸ›

Chris Vickery

πŸ’»

Bryce Reynolds

πŸ’»

James, please

πŸ€” πŸ’»

Spyros Ioakeimidis

πŸ’»

Fernando Costa

πŸ’»

snipe

πŸ“–

Gant Laborde

πŸ’»

Bryce Reynolds

πŸ’»

James, please

πŸ€” πŸ’»

Spyros Ioakeimidis

πŸ’»

Fernando Costa

πŸ’»

snipe

πŸ“–

Gant Laborde

πŸ’»

Md Zubair Ahmed

πŸ“– πŸ› πŸ’» ⚠️

Divjot Singh

πŸ“–

JoΓ£o Marques

πŸ’» πŸ“– πŸ€”

Andrew Lisowski

πŸ’» πŸ“– ⚠️

Xianming Zhong

πŸ“–

C.Y.Xu

πŸ’»

Md Zubair Ahmed

πŸ“– πŸ› πŸ’» ⚠️

Divjot Singh

πŸ“–

JoΓ£o Marques

πŸ’» πŸ“– πŸ€”

Andrew Lisowski

πŸ’» πŸ“– ⚠️

Xianming Zhong

πŸ“–

C.Y.Xu

πŸ’»

Dura

πŸ“–

Jake Bolam

πŸš‡ πŸ’» πŸ“– ⚠️ πŸ‘€ πŸ’¬

Maximilian Berkmann

πŸ’» ⚠️ πŸ“– πŸ”§ 🚧 πŸ‘€ πŸ’¬

Dura

πŸ“–

Jake Bolam

πŸš‡ πŸ’» πŸ“– ⚠️ πŸ‘€ πŸ’¬

Maximilian Berkmann

πŸ’» ⚠️ πŸ“– πŸ”§ 🚧 πŸ‘€ πŸ’¬

tbenning

🎨

ehmicky

πŸ’»

James George

πŸ’»

ehmicky

πŸ’»

James George

πŸ’»

Nick Schonning

πŸ’»

Cezar Augusto

πŸ“–

Jeppe Reinhold

πŸ’»

Rachel M. Carmena

πŸ’»

simon3000

⚠️

SnOβ‚‚WMaN

πŸ’»

Nick Schonning

πŸ’»

Cezar Augusto

πŸ“–

Jeppe Reinhold

πŸ’»

Rachel M. Carmena

πŸ’»

simon3000

⚠️

SnOβ‚‚WMaN

πŸ’»

Fabrizio

πŸ› πŸ’»

kharaone

πŸ’»

Marcelo Alves

πŸ’» ⚠️

Anand Chowdhary

⚠️ πŸ› πŸ’»

Nicolas Goutay

πŸ’»

Tyler Krupicka

πŸ’» ⚠️

Fabrizio

πŸ› πŸ’»

kharaone

πŸ’»

Marcelo Alves

πŸ’» ⚠️

Anand Chowdhary

⚠️ πŸ› πŸ’»

Nicolas Goutay

πŸ’»

Tyler Krupicka

πŸ’» ⚠️

Stefano Moia

πŸ’»

Stefano Moia

πŸ’»

IlaΓ― Deutel

πŸ“¦

Justin Dalrymple

πŸ’»

Piotr StΔ™pniewski

πŸ› πŸ’» ⚠️

Gregor Martynus

πŸ‘€ πŸ’¬

Jeff Wen

πŸ‘€

Justin Dalrymple

πŸ’»

Piotr StΔ™pniewski

πŸ› πŸ’» ⚠️

Gregor Martynus

πŸ‘€ πŸ’¬

Jeff Wen

πŸ‘€

PaweΕ‚ Kowalski

πŸ’»

Markus LΓΆning

πŸ’»

David Anson

πŸ›

Jeroen Claassens

πŸ’»

Erek Speed

πŸ’»

Shai Reznik

πŸ› πŸ’» ⚠️

PaweΕ‚ Kowalski

πŸ’»

Markus LΓΆning

πŸ’»

David Anson

πŸ›

Jeroen Claassens

πŸ’»

Erek Speed

πŸ’»

Shai Reznik

πŸ› πŸ’» ⚠️

Darek Kay

πŸ’» ⚠️

LaChapeliere

πŸ’»

SirWindfield

πŸ’»

Darek Kay

πŸ’» ⚠️

LaChapeliere

πŸ’»

SirWindfield

πŸ’»

G r e y

πŸ›‘οΈ

Lucas Cimon

πŸ“–
From deb6be93f0a27248582041ca35fccedf9a2a11a2 Mon Sep 17 00:00:00 2001 From: Pierre Huyghe Date: Wed, 7 Sep 2022 10:19:41 +0200 Subject: [PATCH 06/28] refactor: add tbody to contributors table (#307) * refactor: add tbody to contributors table * chore(node): bump version to lts * fix(html): add correct indentation * test(url): fix bind error message Co-authored-by: Pierre Huyghe --- .circleci/config.yml | 2 +- .nvmrc | 2 +- .../__tests__/__snapshots__/index.js.snap | 36 ++++++++------- src/generate/index.js | 10 ++-- src/util/__tests__/url.js | 46 +++++++++++-------- 5 files changed, 54 insertions(+), 42 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 009ab1e2..ceb88c74 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 docker_defaults: &docker_defaults docker: - - image: circleci/node:12.14.0 + - image: cimg/node:16.17.0 commands: prep_env: diff --git a/.nvmrc b/.nvmrc index 65d83ce5..2a4e4ab8 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -12.14.0 +16.17.0 diff --git a/src/generate/__tests__/__snapshots__/index.js.snap b/src/generate/__tests__/__snapshots__/index.js.snap index 52a0eeb3..cb402f95 100644 --- a/src/generate/__tests__/__snapshots__/index.js.snap +++ b/src/generate/__tests__/__snapshots__/index.js.snap @@ -11,11 +11,13 @@ These people contributed to the project: - - - - - + + + + + + +
Kent C. Dodds is awesome!Divjot Singh is awesome!Jeroen Engels is awesome!
Kent C. Dodds is awesome!Divjot Singh is awesome!Jeroen Engels is awesome!
@@ -37,17 +39,19 @@ These people contributed to the project: - - - - - - - - - - - + + + + + + + + + + + + +
Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!
Kent C. Dodds is awesome!Kent C. Dodds is awesome!
Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!
Kent C. Dodds is awesome!Kent C. Dodds is awesome!
diff --git a/src/generate/index.js b/src/generate/index.js index cacc21e6..b9b7e213 100644 --- a/src/generate/index.js +++ b/src/generate/index.js @@ -3,7 +3,7 @@ const formatBadge = require('./format-badge') const formatContributor = require('./format-contributor') function injectListBetweenTags(newContent) { - return function(previousContent) { + return function (previousContent) { const tagToLookFor = `' const startOfOpeningTagIndex = previousContent.indexOf( @@ -39,7 +39,7 @@ function injectListBetweenTags(newContent) { function formatLine(contributors) { return `${contributors.join( - '\n ', + '\n ', )}` } @@ -55,15 +55,15 @@ function generateContributorsList(options, contributors) { }), _.chunk(options.contributorsPerLine), _.map(formatLine), - _.join('\n \n \n '), + _.join('\n \n \n '), newContent => { - return `\n\n \n ${newContent}\n \n
\n\n` + return `\n\n \n \n ${newContent}\n \n \n
\n\n` }, )(contributors) } function replaceBadge(newContent) { - return function(previousContent) { + return function (previousContent) { const tagToLookFor = `' const startOfOpeningTagIndex = previousContent.indexOf( diff --git a/src/util/__tests__/url.js b/src/util/__tests__/url.js index 50ff6d4d..359775e9 100644 --- a/src/util/__tests__/url.js +++ b/src/util/__tests__/url.js @@ -1,49 +1,57 @@ -import url from '../url'; +import url from '../url' test(`Result of protocol validation should be true`, () => { - expect(url.isHttpProtocol('http:')).toBe(true) - expect(url.isHttpProtocol('https:')).toBe(true) + expect(url.isHttpProtocol('http:')).toBe(true) + expect(url.isHttpProtocol('https:')).toBe(true) }) test(`Result of protocol validation should be false`, () => { - expect(url.isHttpProtocol('ftp:')).toBe(false) + expect(url.isHttpProtocol('ftp:')).toBe(false) }) test(`Result of url validation should be true`, () => { - expect(url.isValidHttpUrl('https://api.github.com/users/octocat')).toBe(true) + expect(url.isValidHttpUrl('https://api.github.com/users/octocat')).toBe(true) }) test(`Result of url validation should be false when url uses wrong protocol`, () => { - expect(url.isValidHttpUrl('git://git@github.com:all-contributors/all-contributors-cli.git')).toBe(false) + expect( + url.isValidHttpUrl( + 'git://git@github.com:all-contributors/all-contributors-cli.git', + ), + ).toBe(false) }) test(`Result of url validation should be false when input isn't url`, () => { - expect(url.isValidHttpUrl('github-octocat')).toBe(false) + expect(url.isValidHttpUrl('github-octocat')).toBe(false) }) test(`Result of parsed url should be equal`, () => { - const input = 'https://api.github.com/users/octocat' - const expected = 'https://api.github.com/users/octocat' - expect(url.parseHttpUrl(input)).toBe(expected) + const input = 'https://api.github.com/users/octocat' + const expected = 'https://api.github.com/users/octocat' + expect(url.parseHttpUrl(input)).toBe(expected) }) test(`Result of parsed url without protocol should be equal`, () => { - const input = 'example.com' - const expected = 'http://example.com/' - expect(url.parseHttpUrl(input)).toBe(expected) + const input = 'example.com' + const expected = 'http://example.com/' + expect(url.parseHttpUrl(input)).toBe(expected) }) test(`Throw an error when parsed input isn't a string`, () => { - const input = 123 - expect(url.parseHttpUrl.bind(null, input)).toThrowError('input must be a string') + const input = 123 + expect(url.parseHttpUrl.bind(null, input)).toThrowError( + 'input must be a string', + ) }) test(`Throw an error when parsed url has wrong protocol`, () => { - const input = 'ftp://domain.xyz' - expect(url.parseHttpUrl.bind(null, input)).toThrowError('Provided URL has an invalid protocol') + const input = 'ftp://domain.xyz' + expect(url.parseHttpUrl.bind(null, input)).toThrowError( + 'Provided URL has an invalid protocol', + ) }) test(`Throw an error when parsed input isn't a URL`, () => { - const input = 'some string' - expect(url.parseHttpUrl.bind(null, input)).toThrowError('Invalid URL: http://some string') + const input = 'some string' + expect(url.parseHttpUrl.bind(null, input)).toThrowError('Invalid URL') }) From 0b9706252ca88fd075c5cfb9030c44de96046d1c Mon Sep 17 00:00:00 2001 From: Maximilian Berkmann Date: Wed, 7 Sep 2022 09:24:11 +0100 Subject: [PATCH 07/28] chore(deps): bump dependencies and devDeps (#298) Bump dependencies that seems to have been missed by greenkeeper Co-authored-by: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com> --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 68be55a9..5ff44f18 100644 --- a/package.json +++ b/package.json @@ -43,20 +43,20 @@ "homepage": "https://github.com/all-contributors/all-contributors-cli#readme", "dependencies": { "@babel/runtime": "^7.7.6", - "async": "^3.0.1", + "async": "^3.1.0", "chalk": "^4.0.0", "didyoumean": "^1.2.1", "inquirer": "^7.3.3", - "json-fixer": "^1.5.1", + "json-fixer": "^1.6.8", "lodash": "^4.11.2", "node-fetch": "^2.6.0", "pify": "^5.0.0", "yargs": "^15.0.1" }, "devDependencies": { - "codecov": "^3.1.0", - "cz-conventional-changelog": "^3.0.0", - "git-cz": "^4.1.0", + "codecov": "^3.8.1", + "cz-conventional-changelog": "^3.3.0", + "git-cz": "^4.7.6", "kcd-scripts": "^6.2.0", "nock": "^12.0.0", "semantic-release": "^17.0.8" From e1fd794ef7e161c94576fdec5946c536de15723d Mon Sep 17 00:00:00 2001 From: Jake Bolam Date: Wed, 7 Sep 2022 04:27:30 -0400 Subject: [PATCH 08/28] fix: set default value as `7` for `contributorsPerLine` (#139) fix: set default value as `7` for `contributorsPerLine` Co-authored-by: Maximilian Berkmann Co-authored-by: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com> --- src/generate/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/generate/index.js b/src/generate/index.js index b9b7e213..05fb9dd9 100644 --- a/src/generate/index.js +++ b/src/generate/index.js @@ -44,6 +44,7 @@ function formatLine(contributors) { } function generateContributorsList(options, contributors) { + const contributorsPerLine = options.contributorsPerLine || 7 return _.flow( _.sortBy(contributor => { if (options.contributorsSortAlphabetically) { @@ -53,7 +54,7 @@ function generateContributorsList(options, contributors) { _.map(function formatEveryContributor(contributor) { return formatContributor(options, contributor) }), - _.chunk(options.contributorsPerLine), + _.chunk(contributorsPerLine), _.map(formatLine), _.join('\n \n \n '), newContent => { From 5df6b47f8a200b40f9278c221c7aa537d3d3c832 Mon Sep 17 00:00:00 2001 From: Dominic Saadi Date: Wed, 7 Sep 2022 17:31:03 +0900 Subject: [PATCH 09/28] fix: trim `nextLink` before slicing (#309) fix: trim `nextLink` before slicing --- src/repo/github.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repo/github.js b/src/repo/github.js index be671404..15261e63 100644 --- a/src/repo/github.js +++ b/src/repo/github.js @@ -45,7 +45,7 @@ function getNextLink(link) { return null } - return nextLink.split(';')[0].slice(1, -1) + return nextLink.split(';')[0].trim().slice(1, -1) } function getContributorsPage(githubUrl, optionalPrivateToken) { From 531b7e1c4a3bd04c2abdb5201f6289198dc051d4 Mon Sep 17 00:00:00 2001 From: Chad Dougherty Date: Thu, 8 Sep 2022 12:00:44 -0400 Subject: [PATCH 10/28] fix: incorrect usage of `tbody` (#311) --- src/generate/__tests__/__snapshots__/index.js.snap | 4 ++-- src/generate/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/generate/__tests__/__snapshots__/index.js.snap b/src/generate/__tests__/__snapshots__/index.js.snap index cb402f95..15d4d74b 100644 --- a/src/generate/__tests__/__snapshots__/index.js.snap +++ b/src/generate/__tests__/__snapshots__/index.js.snap @@ -17,7 +17,7 @@ These people contributed to the project: Divjot Singh is awesome! Jeroen Engels is awesome! - + @@ -51,7 +51,7 @@ These people contributed to the project: Kent C. Dodds is awesome! Kent C. Dodds is awesome! - + diff --git a/src/generate/index.js b/src/generate/index.js index 05fb9dd9..99828295 100644 --- a/src/generate/index.js +++ b/src/generate/index.js @@ -58,7 +58,7 @@ function generateContributorsList(options, contributors) { _.map(formatLine), _.join('\n \n \n '), newContent => { - return `\n\n \n \n ${newContent}\n \n \n
\n\n` + return `\n\n \n \n ${newContent}\n \n \n
\n\n` }, )(contributors) } From 220eac29d42fd6c9d9d35279525f36f02de4fc82 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 9 Sep 2022 07:24:13 +0800 Subject: [PATCH 11/28] docs: add JoshuaKGoldberg as a contributor for bug (#314) Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++ README.md | 161 ++++++++++++++++++++++---------------------- 2 files changed, 91 insertions(+), 79 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index afe1e39a..c590a91c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -576,6 +576,15 @@ "contributions": [ "doc" ] + }, + { + "login": "JoshuaKGoldberg", + "name": "Josh Goldberg", + "avatar_url": "https://avatars.githubusercontent.com/u/3335181?v=4", + "profile": "http://www.joshuakgoldberg.com", + "contributions": [ + "bug" + ] } ], "skipCi": true diff --git a/README.md b/README.md index 1eae84d9..8bfc66f7 100644 --- a/README.md +++ b/README.md @@ -79,85 +79,88 @@ Thanks goes to these wonderful people - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Jeroen Engels

πŸ’» πŸ“– ⚠️

Kent C. Dodds

πŸ“– πŸ’»

JoΓ£o GuimarΓ£es

πŸ’»

Ben Briggs

πŸ’»

Itai Steinherz

πŸ“– πŸ’»

Alex Jover

πŸ’» πŸ“–

Jerod Santo

πŸ’»

Kevin Jalbert

πŸ’»

tunnckoCore

πŸ”§

Mehdi Achour

πŸ’»

Roy Revelt

πŸ›

Chris Vickery

πŸ’»

Bryce Reynolds

πŸ’»

James, please

πŸ€” πŸ’»

Spyros Ioakeimidis

πŸ’»

Fernando Costa

πŸ’»

snipe

πŸ“–

Gant Laborde

πŸ’»

Md Zubair Ahmed

πŸ“– πŸ› πŸ’» ⚠️

Divjot Singh

πŸ“–

JoΓ£o Marques

πŸ’» πŸ“– πŸ€”

Andrew Lisowski

πŸ’» πŸ“– ⚠️

Xianming Zhong

πŸ“–

C.Y.Xu

πŸ’»

Dura

πŸ“–

Jake Bolam

πŸš‡ πŸ’» πŸ“– ⚠️ πŸ‘€ πŸ’¬

Maximilian Berkmann

πŸ’» ⚠️ πŸ“– πŸ”§ 🚧 πŸ‘€ πŸ’¬

tbenning

🎨

ehmicky

πŸ’»

James George

πŸ’»

Nick Schonning

πŸ’»

Cezar Augusto

πŸ“–

Jeppe Reinhold

πŸ’»

Rachel M. Carmena

πŸ’»

simon3000

⚠️

SnOβ‚‚WMaN

πŸ’»

Fabrizio

πŸ› πŸ’»

kharaone

πŸ’»

Marcelo Alves

πŸ’» ⚠️

Anand Chowdhary

⚠️ πŸ› πŸ’»

Nicolas Goutay

πŸ’»

Tyler Krupicka

πŸ’» ⚠️

Stefano Moia

πŸ’»

IlaΓ― Deutel

πŸ“¦

Justin Dalrymple

πŸ’»

Piotr StΔ™pniewski

πŸ› πŸ’» ⚠️

Gregor Martynus

πŸ‘€ πŸ’¬

Jeff Wen

πŸ‘€

PaweΕ‚ Kowalski

πŸ’»

Markus LΓΆning

πŸ’»

David Anson

πŸ›

Jeroen Claassens

πŸ’»

Erek Speed

πŸ’»

Shai Reznik

πŸ› πŸ’» ⚠️

Darek Kay

πŸ’» ⚠️

LaChapeliere

πŸ’»

SirWindfield

πŸ’»

G r e y

πŸ›‘οΈ

Lucas Cimon

πŸ“–

Jeroen Engels

πŸ’» πŸ“– ⚠️

Kent C. Dodds

πŸ“– πŸ’»

JoΓ£o GuimarΓ£es

πŸ’»

Ben Briggs

πŸ’»

Itai Steinherz

πŸ“– πŸ’»

Alex Jover

πŸ’» πŸ“–

Jerod Santo

πŸ’»

Kevin Jalbert

πŸ’»

tunnckoCore

πŸ”§

Mehdi Achour

πŸ’»

Roy Revelt

πŸ›

Chris Vickery

πŸ’»

Bryce Reynolds

πŸ’»

James, please

πŸ€” πŸ’»

Spyros Ioakeimidis

πŸ’»

Fernando Costa

πŸ’»

snipe

πŸ“–

Gant Laborde

πŸ’»

Md Zubair Ahmed

πŸ“– πŸ› πŸ’» ⚠️

Divjot Singh

πŸ“–

JoΓ£o Marques

πŸ’» πŸ“– πŸ€”

Andrew Lisowski

πŸ’» πŸ“– ⚠️

Xianming Zhong

πŸ“–

C.Y.Xu

πŸ’»

Dura

πŸ“–

Jake Bolam

πŸš‡ πŸ’» πŸ“– ⚠️ πŸ‘€ πŸ’¬

Maximilian Berkmann

πŸ’» ⚠️ πŸ“– πŸ”§ 🚧 πŸ‘€ πŸ’¬

tbenning

🎨

ehmicky

πŸ’»

James George

πŸ’»

Nick Schonning

πŸ’»

Cezar Augusto

πŸ“–

Jeppe Reinhold

πŸ’»

Rachel M. Carmena

πŸ’»

simon3000

⚠️

SnOβ‚‚WMaN

πŸ’»

Fabrizio

πŸ› πŸ’»

kharaone

πŸ’»

Marcelo Alves

πŸ’» ⚠️

Anand Chowdhary

⚠️ πŸ› πŸ’»

Nicolas Goutay

πŸ’»

Tyler Krupicka

πŸ’» ⚠️

Stefano Moia

πŸ’»

IlaΓ― Deutel

πŸ“¦

Justin Dalrymple

πŸ’»

Piotr StΔ™pniewski

πŸ› πŸ’» ⚠️

Gregor Martynus

πŸ‘€ πŸ’¬

Jeff Wen

πŸ‘€

PaweΕ‚ Kowalski

πŸ’»

Markus LΓΆning

πŸ’»

David Anson

πŸ›

Jeroen Claassens

πŸ’»

Erek Speed

πŸ’»

Shai Reznik

πŸ› πŸ’» ⚠️

Darek Kay

πŸ’» ⚠️

LaChapeliere

πŸ’»

SirWindfield

πŸ’»

G r e y

πŸ›‘οΈ

Lucas Cimon

πŸ“–

Josh Goldberg

πŸ›
From c8fdc639e60b9323a2d9b09bfd72324fb9bba6de Mon Sep 17 00:00:00 2001 From: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com> Date: Sat, 10 Sep 2022 01:53:05 +0800 Subject: [PATCH 12/28] chore: fix status badges (#315) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8bfc66f7..a2974f5f 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ -[![Build Status](https://img.shields.io/circleci/project/all-contributors/all-contributors-cli/master.svg)](https://circleci.com/gh/all-contributors/workflows/all-contributors-cli/tree/master) -[![Code Coverage](https://img.shields.io/codecov/c/github/all-contributors/all-contributors-cli.svg)](https://codecov.io/github/all-contributors/all-contributors-cli) +[![Build Status](https://dl.circleci.com/status-badge/img/gh/all-contributors/cli/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/all-contributors/cli/tree/master) +[![Code Coverage](https://codecov.io/gh/all-contributors/cli/branch/master/graph/badge.svg?token=jHIrCqevli)](https://codecov.io/gh/all-contributors/cli) [![Version](https://img.shields.io/npm/v/all-contributors-cli.svg)](https://www.npmjs.com/package/all-contributors-cli) [![Downloads](https://img.shields.io/npm/dm/all-contributors-cli.svg)](http://www.npmtrends.com/all-contributors-cli) [![AUR Version](https://img.shields.io/aur/version/all-contributors-cli.svg)](https://aur.archlinux.org/packages/all-contributors-cli) From 097f741c79920f9e020da29ee7f42c4f7f55e182 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 10 Sep 2022 11:17:27 +1000 Subject: [PATCH 13/28] refactor: log full error stack on error (#316) --- src/cli.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.js b/src/cli.js index 7be588ec..1c52e969 100755 --- a/src/cli.js +++ b/src/cli.js @@ -125,7 +125,7 @@ function checkContributors(argv) { function onError(error) { if (error) { - console.error(error.message) + console.error(error.stack || error.message || error) process.exit(1) } process.exit(0) From e9bc4e2155c2b0c512c06d8f7080cf5b7feccae3 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 16 Sep 2022 23:16:03 +0800 Subject: [PATCH 14/28] docs: add tenshiAMD as a contributor (#322) Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 11 +++++++++++ README.md | 3 +++ 2 files changed, 14 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index c590a91c..31fbea10 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -585,6 +585,17 @@ "contributions": [ "bug" ] + }, + { + "login": "tenshiAMD", + "name": "Angel Aviel Domaoan", + "avatar_url": "https://avatars.githubusercontent.com/u/13580338?v=4", + "profile": "https://tenshiamd.com", + "contributions": [ + "code", + "review", + "doc" + ] } ], "skipCi": true diff --git a/README.md b/README.md index a2974f5f..83086a92 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,9 @@ Thanks goes to these wonderful people
Lucas Cimon

πŸ“–
Josh Goldberg

πŸ› + +
Angel Aviel Domaoan

πŸ’» πŸ‘€ πŸ“– + From 382f44cca32fe9e816c744732e46dafd56516963 Mon Sep 17 00:00:00 2001 From: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com> Date: Thu, 22 Sep 2022 15:32:19 +0800 Subject: [PATCH 15/28] chore: create CODEOWNERS (#319) Co-authored-by: Maximilian Berkmann --- .github/- Create CODEOWNERS to automate reviewers | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/- Create CODEOWNERS to automate reviewers diff --git a/.github/- Create CODEOWNERS to automate reviewers b/.github/- Create CODEOWNERS to automate reviewers new file mode 100644 index 00000000..03b83160 --- /dev/null +++ b/.github/- Create CODEOWNERS to automate reviewers @@ -0,0 +1 @@ +* @all-contributors/core From 94b555e274b2a8fec726c4da152fbb21383e1065 Mon Sep 17 00:00:00 2001 From: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com> Date: Sat, 24 Sep 2022 00:49:38 +0800 Subject: [PATCH 16/28] fix: set `commitConvention` default same as `app` (#318) --- src/init/prompt.js | 13 +++++-------- src/util/config-file.js | 6 ++---- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/init/prompt.js b/src/init/prompt.js index 87446a54..c6a402d8 100644 --- a/src/init/prompt.js +++ b/src/init/prompt.js @@ -35,7 +35,7 @@ const questions = [ name: 'repoHost', message: "Where is the repository hosted? Hit Enter if it's on GitHub or GitLab", - default: function(answers) { + default: function (answers) { if (answers.repoType === 'github') { return 'https://github.com' } else if (answers.repoType === 'gitlab') { @@ -58,10 +58,10 @@ const questions = [ type: 'input', name: 'badgeFile', message: 'In which file should the badge be shown?', - when: function(answers) { + when: function (answers) { return answers.needBadge }, - default: function(answers) { + default: function (answers) { return answers.contributorFile }, }, @@ -84,14 +84,11 @@ const questions = [ name: 'commitConvention', message: 'What commit convention would you want it to use?', choices: Object.values(conventions), - default: 'none', + default: 'angular', }, ] -const uniqueFiles = _.flow( - _.compact, - _.uniq, -) +const uniqueFiles = _.flow(_.compact, _.uniq) module.exports = function prompt() { return git diff --git a/src/util/config-file.js b/src/util/config-file.js index 912d95fb..fdcb154d 100644 --- a/src/util/config-file.js +++ b/src/util/config-file.js @@ -10,7 +10,7 @@ function readConfig(configPath) { config.repoType = 'github' } if (!('commitConvention' in config)) { - config.commitConvention = 'none' + config.commitConvention = 'angular' } if (changed) { //Updates the file with fixes @@ -20,9 +20,7 @@ function readConfig(configPath) { } catch (error) { if (error instanceof SyntaxError) { throw new SyntaxError( - `Configuration file has malformed JSON: ${configPath}. Error:: ${ - error.message - }`, + `Configuration file has malformed JSON: ${configPath}. Error:: ${error.message}`, ) } if (error.code === 'ENOENT') { From 9d82568f41ae873d01e40b6f359a627ece5cf76f Mon Sep 17 00:00:00 2001 From: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com> Date: Sat, 24 Sep 2022 00:55:19 +0800 Subject: [PATCH 17/28] fix: add alt value for contributor image (#334) --- src/generate/__tests__/format-contributor.js | 10 +++++----- src/generate/format-contributor.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/generate/__tests__/format-contributor.js b/src/generate/__tests__/format-contributor.js index bb3451ec..9dd4b638 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

πŸ‘€' 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

πŸ“– πŸ‘€ πŸ’¬' 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

πŸ‘€' 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?

πŸ“–' 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
🌍' expect(formatContributor(options, contributor)).toBe(expected) }) diff --git a/src/generate/format-contributor.js b/src/generate/format-contributor.js index 048d63db..7966a93c 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 %>', ) const avatarBlockTemplate = _.template( '<%= avatar %>
<%= name %>
', From 109b2614d28e0e2a248d73cdbccacf37069a766d Mon Sep 17 00:00:00 2001 From: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com> Date: Sat, 24 Sep 2022 01:17:50 +0800 Subject: [PATCH 18/28] fix: set alt value for contributor image with no complete name (#335) --- src/generate/__tests__/fixtures/contributors.json | 5 +++++ src/generate/__tests__/format-contributor.js | 10 ++++++++++ src/generate/format-contributor.js | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/generate/__tests__/fixtures/contributors.json b/src/generate/__tests__/fixtures/contributors.json index 7872bd3b..7ede43c1 100644 --- a/src/generate/__tests__/fixtures/contributors.json +++ b/src/generate/__tests__/fixtures/contributors.json @@ -25,6 +25,11 @@ "avatar_url": "https://avatars1.githubusercontent.com/u/1500684", "contributions": ["translation"] }, + "nocompletename": { + "login": "nocompletename", + "avatar_url": "https://avatars1.githubusercontent.com/u/1500684", + "contributions": ["translation"] + }, "nologin_badrole": { "name": "Wildly Misconfigured", "avatar_url": "https://avatars1.githubusercontent.com/u/1500684", diff --git a/src/generate/__tests__/format-contributor.js b/src/generate/__tests__/format-contributor.js index 9dd4b638..c158cb39 100644 --- a/src/generate/__tests__/format-contributor.js +++ b/src/generate/__tests__/format-contributor.js @@ -77,3 +77,13 @@ test('format contributor with no GitHub account', () => { expect(formatContributor(options, contributor)).toBe(expected) }) + +test('format contributor with no complete name', () => { + const contributor = contributors.nocompletename + const {options} = fixtures() + + const expected = + 'nocompletename
nocompletename
🌍' + + expect(formatContributor(options, contributor)).toBe(expected) +}) diff --git a/src/generate/format-contributor.js b/src/generate/format-contributor.js index 7966a93c..9f489f40 100644 --- a/src/generate/format-contributor.js +++ b/src/generate/format-contributor.js @@ -17,7 +17,9 @@ const contributorTemplate = _.template( const defaultImageSize = 100 function defaultTemplate(templateData) { - const name = escapeName(templateData.contributor.name) + const rawName = + templateData.contributor.name || templateData.contributor.login + const name = escapeName(rawName) const avatar = avatarTemplate( _.assign(templateData, { name, From 8db67102cb8b17085d51f1553cbb84aaf998c394 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 28 Sep 2022 01:04:50 +0800 Subject: [PATCH 19/28] docs: add 12rambau as a contributor for code (#337) Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 31fbea10..b9055e21 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -596,6 +596,15 @@ "review", "doc" ] + }, + { + "login": "12rambau", + "name": "Rambaud Pierrick", + "avatar_url": "https://avatars.githubusercontent.com/u/12596392?v=4", + "profile": "https://12rambau.github.io/web-resume/", + "contributions": [ + "code" + ] } ], "skipCi": true diff --git a/README.md b/README.md index 83086a92..d08970f1 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,7 @@ Thanks goes to these wonderful people
Angel Aviel Domaoan

πŸ’» πŸ‘€ πŸ“– +
Rambaud Pierrick

πŸ’» From 7a9150fa526e4776b7e76fd9931e717eea1df843 Mon Sep 17 00:00:00 2001 From: Rambaud Pierrick <12rambau@users.noreply.github.com> Date: Tue, 27 Sep 2022 19:07:15 +0200 Subject: [PATCH 20/28] feat: adapt to rst (#301) Co-authored-by: Maximilian Berkmann Co-authored-by: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com> --- src/generate/index.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/generate/index.js b/src/generate/index.js index 99828295..1f14e1e1 100644 --- a/src/generate/index.js +++ b/src/generate/index.js @@ -24,11 +24,17 @@ function injectListBetweenTags(newContent) { ) { return previousContent } + const startIndent = Math.max( + 0, + previousContent.lastIndexOf('\n', startOfOpeningTagIndex), + ) + const nbSpaces = + startOfOpeningTagIndex - Math.min(startOfOpeningTagIndex, startIndent) return [ previousContent.slice(0, endOfOpeningTagIndex + closingTag.length), '\n', '\n', - newContent, + newContent.replace('\n', `\n${' '.repeat(nbSpaces - 1)}`), '', '\n', '\n\n', @@ -85,10 +91,16 @@ function replaceBadge(newContent) { ) { return previousContent } + const startIndent = Math.max( + 0, + previousContent.lastIndexOf('\n', startOfOpeningTagIndex), + ) + const nbSpaces = + startOfOpeningTagIndex - Math.min(startOfOpeningTagIndex, startIndent) return [ previousContent.slice(0, endOfOpeningTagIndex + closingTag.length), '\n', - newContent, + newContent.replace('\n', `\n${' '.repeat(nbSpaces)}`), '\n', previousContent.slice(startOfClosingTagIndex), ].join('') From b41e668fe40db14e1b8b9b1b74f5f661f82f2f38 Mon Sep 17 00:00:00 2001 From: Jake Bolam Date: Wed, 28 Sep 2022 12:54:52 -0400 Subject: [PATCH 21/28] feat: add footer with link to usage (#163) --- .all-contributorsrc | 1 + README.md | 134 ++++++++++-------- assets/logo-small.svg | 6 + .../__tests__/__snapshots__/index.js.snap | 86 +++++++++++ src/generate/__tests__/index.js | 26 ++++ src/generate/index.js | 18 ++- src/init/prompt.js | 7 + 7 files changed, 214 insertions(+), 64 deletions(-) create mode 100644 assets/logo-small.svg diff --git a/.all-contributorsrc b/.all-contributorsrc index b9055e21..0e57947e 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -5,6 +5,7 @@ "repoType": "github", "commit": false, "contributorsPerLine": 6, + "linkToUsage": true, "files": [ "README.md" ], diff --git a/README.md b/README.md index d08970f1..b2c2ad92 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ -- [ all-contributors-cli ](#all-contributors-cli) + +- [ + all-contributors-cli +](#all-contributors-cli) - [The problem](#the-problem) - [This solution](#this-solution) - [Using the all-contributors-cli](#using-the-all-contributors-cli) @@ -81,90 +84,99 @@ Thanks goes to these wonderful people - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + + + + + +

Jeroen Engels

πŸ’» πŸ“– ⚠️

Kent C. Dodds

πŸ“– πŸ’»

JoΓ£o GuimarΓ£es

πŸ’»

Ben Briggs

πŸ’»

Itai Steinherz

πŸ“– πŸ’»

Alex Jover

πŸ’» πŸ“–
Jeroen Engels
Jeroen Engels

πŸ’» πŸ“– ⚠️
Kent C. Dodds
Kent C. Dodds

πŸ“– πŸ’»
JoΓ£o GuimarΓ£es
JoΓ£o GuimarΓ£es

πŸ’»
Ben Briggs
Ben Briggs

πŸ’»
Itai Steinherz
Itai Steinherz

πŸ“– πŸ’»
Alex Jover
Alex Jover

πŸ’» πŸ“–

Jerod Santo

πŸ’»

Kevin Jalbert

πŸ’»

tunnckoCore

πŸ”§

Mehdi Achour

πŸ’»

Roy Revelt

πŸ›

Chris Vickery

πŸ’»
Jerod Santo
Jerod Santo

πŸ’»
Kevin Jalbert
Kevin Jalbert

πŸ’»
tunnckoCore
tunnckoCore

πŸ”§
Mehdi Achour
Mehdi Achour

πŸ’»
Roy Revelt
Roy Revelt

πŸ›
Chris Vickery
Chris Vickery

πŸ’»

Bryce Reynolds

πŸ’»

James, please

πŸ€” πŸ’»

Spyros Ioakeimidis

πŸ’»

Fernando Costa

πŸ’»

snipe

πŸ“–

Gant Laborde

πŸ’»
Bryce Reynolds
Bryce Reynolds

πŸ’»
James, please
James, please

πŸ€” πŸ’»
Spyros Ioakeimidis
Spyros Ioakeimidis

πŸ’»
Fernando Costa
Fernando Costa

πŸ’»
snipe
snipe

πŸ“–
Gant Laborde
Gant Laborde

πŸ’»

Md Zubair Ahmed

πŸ“– πŸ› πŸ’» ⚠️

Divjot Singh

πŸ“–

JoΓ£o Marques

πŸ’» πŸ“– πŸ€”

Andrew Lisowski

πŸ’» πŸ“– ⚠️

Xianming Zhong

πŸ“–

C.Y.Xu

πŸ’»
Md Zubair Ahmed
Md Zubair Ahmed

πŸ“– πŸ› πŸ’» ⚠️
Divjot Singh
Divjot Singh

πŸ“–
JoΓ£o Marques
JoΓ£o Marques

πŸ’» πŸ“– πŸ€”
Andrew Lisowski
Andrew Lisowski

πŸ’» πŸ“– ⚠️
Xianming Zhong
Xianming Zhong

πŸ“–
C.Y.Xu
C.Y.Xu

πŸ’»

Dura

πŸ“–

Jake Bolam

πŸš‡ πŸ’» πŸ“– ⚠️ πŸ‘€ πŸ’¬

Maximilian Berkmann

πŸ’» ⚠️ πŸ“– πŸ”§ 🚧 πŸ‘€ πŸ’¬

tbenning

🎨

ehmicky

πŸ’»

James George

πŸ’»
Dura
Dura

πŸ“–
Jake Bolam
Jake Bolam

πŸš‡ πŸ’» πŸ“– ⚠️ πŸ‘€ πŸ’¬
Maximilian Berkmann
Maximilian Berkmann

πŸ’» ⚠️ πŸ“– πŸ”§ 🚧 πŸ‘€ πŸ’¬
tbenning
tbenning

🎨
ehmicky
ehmicky

πŸ’»
James George
James George

πŸ’»

Nick Schonning

πŸ’»

Cezar Augusto

πŸ“–

Jeppe Reinhold

πŸ’»

Rachel M. Carmena

πŸ’»

simon3000

⚠️

SnOβ‚‚WMaN

πŸ’»
Nick Schonning
Nick Schonning

πŸ’»
Cezar Augusto
Cezar Augusto

πŸ“–
Jeppe Reinhold
Jeppe Reinhold

πŸ’»
Rachel M. Carmena
Rachel M. Carmena

πŸ’»
simon3000
simon3000

⚠️
SnOβ‚‚WMaN
SnOβ‚‚WMaN

πŸ’»

Fabrizio

πŸ› πŸ’»

kharaone

πŸ’»

Marcelo Alves

πŸ’» ⚠️

Anand Chowdhary

⚠️ πŸ› πŸ’»

Nicolas Goutay

πŸ’»

Tyler Krupicka

πŸ’» ⚠️
Fabrizio
Fabrizio

πŸ› πŸ’»
kharaone
kharaone

πŸ’»
Marcelo Alves
Marcelo Alves

πŸ’» ⚠️
Anand Chowdhary
Anand Chowdhary

⚠️ πŸ› πŸ’»
Nicolas Goutay
Nicolas Goutay

πŸ’»
Tyler Krupicka
Tyler Krupicka

πŸ’» ⚠️

Stefano Moia

πŸ’»

IlaΓ― Deutel

πŸ“¦

Justin Dalrymple

πŸ’»

Piotr StΔ™pniewski

πŸ› πŸ’» ⚠️

Gregor Martynus

πŸ‘€ πŸ’¬

Jeff Wen

πŸ‘€
Stefano Moia
Stefano Moia

πŸ’»
IlaΓ― Deutel
IlaΓ― Deutel

πŸ“¦
Justin Dalrymple
Justin Dalrymple

πŸ’»
Piotr StΔ™pniewski
Piotr StΔ™pniewski

πŸ› πŸ’» ⚠️
Gregor Martynus
Gregor Martynus

πŸ‘€ πŸ’¬
Jeff Wen
Jeff Wen

πŸ‘€

PaweΕ‚ Kowalski

πŸ’»

Markus LΓΆning

πŸ’»

David Anson

πŸ›

Jeroen Claassens

πŸ’»

Erek Speed

πŸ’»

Shai Reznik

πŸ› πŸ’» ⚠️
PaweΕ‚ Kowalski
PaweΕ‚ Kowalski

πŸ’»
Markus LΓΆning
Markus LΓΆning

πŸ’»
David Anson
David Anson

πŸ›
Jeroen Claassens
Jeroen Claassens

πŸ’»
Erek Speed
Erek Speed

πŸ’»
Shai Reznik
Shai Reznik

πŸ› πŸ’» ⚠️

Darek Kay

πŸ’» ⚠️

LaChapeliere

πŸ’»

SirWindfield

πŸ’»

G r e y

πŸ›‘οΈ

Lucas Cimon

πŸ“–

Josh Goldberg

πŸ›
Darek Kay
Darek Kay

πŸ’» ⚠️
LaChapeliere
LaChapeliere

πŸ’»
SirWindfield
SirWindfield

πŸ’»
G r e y
G r e y

πŸ›‘οΈ
Lucas Cimon
Lucas Cimon

πŸ“–
Josh Goldberg
Josh Goldberg

πŸ›

Angel Aviel Domaoan

πŸ’» πŸ‘€ πŸ“–

Rambaud Pierrick

πŸ’»
+ + Add your contributions + +
diff --git a/assets/logo-small.svg b/assets/logo-small.svg new file mode 100644 index 00000000..b8e512af --- /dev/null +++ b/assets/logo-small.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/generate/__tests__/__snapshots__/index.js.snap b/src/generate/__tests__/__snapshots__/index.js.snap index 15d4d74b..7278f002 100644 --- a/src/generate/__tests__/__snapshots__/index.js.snap +++ b/src/generate/__tests__/__snapshots__/index.js.snap @@ -18,6 +18,46 @@ These people contributed to the project: Jeroen Engels is awesome! + + + + + + + + + + +Thanks a lot everyone!" +`; + +exports[`replace the content between the ALL-CONTRIBUTORS-LIST tags by a table of contributors with linkToUsage 1`] = ` +"# project + +Description + +## Contributors +These people contributed to the project: + + + + + + + + + + + + + + + +
Kent C. Dodds is awesome!Divjot Singh is awesome!Jeroen Engels is awesome!
+ + Add your contributions + +
@@ -52,6 +92,52 @@ These people contributed to the project: Kent C. Dodds is awesome! + + + + + + + + + + +Thanks a lot everyone!" +`; + +exports[`split contributors into multiples lines when there are too many with linkToUsage 1`] = ` +"# project + +Description + +## Contributors +These people contributed to the project: + + + + + + + + + + + + + + + + + + + + + +
Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!
Kent C. Dodds is awesome!Kent C. Dodds is awesome!
+ + Add your contributions + +
diff --git a/src/generate/__tests__/index.js b/src/generate/__tests__/index.js index ece35d58..cff3f7c1 100644 --- a/src/generate/__tests__/index.js +++ b/src/generate/__tests__/index.js @@ -43,6 +43,15 @@ test('replace the content between the ALL-CONTRIBUTORS-LIST tags by a table of c expect(result).toMatchSnapshot() }) +test('replace the content between the ALL-CONTRIBUTORS-LIST tags by a table of contributors with linkToUsage', () => { + const {kentcdodds, bogas04} = contributors + const {options, jfmengels, content} = fixtures() + const contributorList = [kentcdodds, bogas04, jfmengels] + const result = generate(Object.assign(options, { linkToUsage: true }), contributorList, content) + + expect(result).toMatchSnapshot() +}) + test('split contributors into multiples lines when there are too many', () => { const {kentcdodds} = contributors const {options, content} = fixtures() @@ -60,6 +69,23 @@ test('split contributors into multiples lines when there are too many', () => { expect(result).toMatchSnapshot() }) +test('split contributors into multiples lines when there are too many with linkToUsage', () => { + const {kentcdodds} = contributors + const {options, content} = fixtures() + const contributorList = [ + kentcdodds, + kentcdodds, + kentcdodds, + kentcdodds, + kentcdodds, + kentcdodds, + kentcdodds, + ] + const result = generate(Object.assign(options, { linkToUsage: true }), contributorList, content) + + expect(result).toMatchSnapshot() +}) + test('sorts the list of contributors if contributorsSortAlphabetically=true', () => { const {kentcdodds, bogas04} = contributors const {options, jfmengels, content} = fixtures() diff --git a/src/generate/index.js b/src/generate/index.js index 1f14e1e1..6dac4250 100644 --- a/src/generate/index.js +++ b/src/generate/index.js @@ -49,8 +49,20 @@ function formatLine(contributors) { )}` } +function formatFooter(options) { + if (!options.linkToUsage) { + return '' + } + const smallLogoURL = + 'https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg' + const linkToBotAdd = 'https://all-contributors.js.org/docs/en/bot/usage' + + return `\n \n \n Add your contributions\n \n \n ` +} + function generateContributorsList(options, contributors) { - const contributorsPerLine = options.contributorsPerLine || 7 + const tableFooter = formatFooter(options) + return _.flow( _.sortBy(contributor => { if (options.contributorsSortAlphabetically) { @@ -60,11 +72,11 @@ function generateContributorsList(options, contributors) { _.map(function formatEveryContributor(contributor) { return formatContributor(options, contributor) }), - _.chunk(contributorsPerLine), + _.chunk(options.contributorsPerLine), _.map(formatLine), _.join('\n \n \n '), newContent => { - return `\n\n \n \n ${newContent}\n \n \n
\n\n` + return `\n\n \n \n ${newContent}\n \n \n \n ${tableFooter}\n \n
\n\n` }, )(contributors) } diff --git a/src/init/prompt.js b/src/init/prompt.js index c6a402d8..c67fd8c3 100644 --- a/src/init/prompt.js +++ b/src/init/prompt.js @@ -86,6 +86,12 @@ const questions = [ choices: Object.values(conventions), default: 'angular', }, + { + type: 'confirm', + name: 'linkToUsage', + message: 'Do you want to add a footer with link to usage?', + default: true, + }, ] const uniqueFiles = _.flow(_.compact, _.uniq) @@ -113,6 +119,7 @@ module.exports = function prompt() { commitConvention: answers.commitConvention, contributors: [], contributorsPerLine: 7, + linkToUsage: answers.linkToUsage, }, contributorFile: answers.contributorFile, badgeFile: answers.badgeFile, From b43a6278f32e3f146129b67b159c61e06b1d6ce4 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 29 Sep 2022 01:52:03 +0800 Subject: [PATCH 22/28] docs: add tenshiAMD as a contributor for test (#338) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 3 ++- README.md | 13 ++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 0e57947e..7ed5c672 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -595,7 +595,8 @@ "contributions": [ "code", "review", - "doc" + "doc", + "test" ] }, { diff --git a/README.md b/README.md index b2c2ad92..c343b922 100644 --- a/README.md +++ b/README.md @@ -164,19 +164,10 @@ Thanks goes to these wonderful people Josh Goldberg
Josh Goldberg

πŸ› -
Angel Aviel Domaoan

πŸ’» πŸ‘€ πŸ“– -
Rambaud Pierrick

πŸ’» + Angel Aviel Domaoan
Angel Aviel Domaoan

πŸ’» πŸ‘€ πŸ“– ⚠️ + Rambaud Pierrick
Rambaud Pierrick

πŸ’» - - - - - Add your contributions - - - - From 048b4e304cd8295cdfde15c1f1fffdf94408aa97 Mon Sep 17 00:00:00 2001 From: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com> Date: Thu, 29 Sep 2022 01:54:12 +0800 Subject: [PATCH 23/28] Rename filename for CODEOWNERS --- .github/{- Create CODEOWNERS to automate reviewers => CODEOWNERS} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{- Create CODEOWNERS to automate reviewers => CODEOWNERS} (100%) diff --git a/.github/- Create CODEOWNERS to automate reviewers b/.github/CODEOWNERS similarity index 100% rename from .github/- Create CODEOWNERS to automate reviewers rename to .github/CODEOWNERS From 8fc7c7e689878f0fefe3c276e873a9247c5f6b1d Mon Sep 17 00:00:00 2001 From: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com> Date: Wed, 5 Oct 2022 05:20:53 +0800 Subject: [PATCH 24/28] feat: add contribution type `promotion` (#339) --- src/util/contribution-types.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/util/contribution-types.js b/src/util/contribution-types.js index 98073263..9d0a3c50 100644 --- a/src/util/contribution-types.js +++ b/src/util/contribution-types.js @@ -1,7 +1,7 @@ const _ = require('lodash/fp') const repo = require('../repo') -const defaultTypes = function(repoType) { +const defaultTypes = function (repoType) { return { a11y: { symbol: '️️️️♿️', @@ -136,9 +136,13 @@ const defaultTypes = function(repoType) { symbol: 'πŸ“Ή', description: 'Videos', }, + promotion: { + symbol: 'πŸ“£', + description: 'Promotion', + }, } } -module.exports = function(options) { +module.exports = function (options) { return _.assign(defaultTypes(options.repoType), options.types) } From 0be7a63481b884f6cbb512e4677601f61a4a7bd8 Mon Sep 17 00:00:00 2001 From: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com> Date: Thu, 6 Oct 2022 22:20:28 +0800 Subject: [PATCH 25/28] fix: cleanup table footer (#341) --- .../__tests__/__snapshots__/index.js.snap | 34 +++++++++++++++---- src/generate/__tests__/index.js | 25 ++++++++++++-- src/generate/index.js | 6 +++- 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/src/generate/__tests__/__snapshots__/index.js.snap b/src/generate/__tests__/__snapshots__/index.js.snap index 7278f002..33183570 100644 --- a/src/generate/__tests__/__snapshots__/index.js.snap +++ b/src/generate/__tests__/__snapshots__/index.js.snap @@ -18,9 +18,6 @@ These people contributed to the project: Jeroen Engels is awesome! - - - @@ -68,6 +65,34 @@ These people contributed to the project: Thanks a lot everyone!" `; +exports[`replace the content between the ALL-CONTRIBUTORS-LIST tags by a table of contributors without linkToUsage 1`] = ` +"# project + +Description + +## Contributors +These people contributed to the project: + + + + + + + + + + + +
Kent C. Dodds is awesome!Divjot Singh is awesome!Jeroen Engels is awesome!
+ + + + + + +Thanks a lot everyone!" +`; + exports[`split contributors into multiples lines when there are too many 1`] = ` "# project @@ -92,9 +117,6 @@ These people contributed to the project: Kent C. Dodds is awesome! - - - diff --git a/src/generate/__tests__/index.js b/src/generate/__tests__/index.js index cff3f7c1..524e58b8 100644 --- a/src/generate/__tests__/index.js +++ b/src/generate/__tests__/index.js @@ -47,7 +47,24 @@ test('replace the content between the ALL-CONTRIBUTORS-LIST tags by a table of c const {kentcdodds, bogas04} = contributors const {options, jfmengels, content} = fixtures() const contributorList = [kentcdodds, bogas04, jfmengels] - const result = generate(Object.assign(options, { linkToUsage: true }), contributorList, content) + const result = generate( + Object.assign(options, {linkToUsage: true}), + contributorList, + content, + ) + + expect(result).toMatchSnapshot() +}) + +test('replace the content between the ALL-CONTRIBUTORS-LIST tags by a table of contributors without linkToUsage', () => { + const {kentcdodds, bogas04} = contributors + const {options, jfmengels, content} = fixtures() + const contributorList = [kentcdodds, bogas04, jfmengels] + const result = generate( + Object.assign(options, {linkToUsage: false}), + contributorList, + content, + ) expect(result).toMatchSnapshot() }) @@ -81,7 +98,11 @@ test('split contributors into multiples lines when there are too many with linkT kentcdodds, kentcdodds, ] - const result = generate(Object.assign(options, { linkToUsage: true }), contributorList, content) + const result = generate( + Object.assign(options, {linkToUsage: true}), + contributorList, + content, + ) expect(result).toMatchSnapshot() }) diff --git a/src/generate/index.js b/src/generate/index.js index 6dac4250..78de5e36 100644 --- a/src/generate/index.js +++ b/src/generate/index.js @@ -62,6 +62,7 @@ function formatFooter(options) { function generateContributorsList(options, contributors) { const tableFooter = formatFooter(options) + let tableFooterContent = '' return _.flow( _.sortBy(contributor => { @@ -76,7 +77,10 @@ function generateContributorsList(options, contributors) { _.map(formatLine), _.join('\n \n \n '), newContent => { - return `\n\n \n \n ${newContent}\n \n \n \n ${tableFooter}\n \n
\n\n` + if (options.linkToUsage) { + tableFooterContent = ` \n ${tableFooter}\n \n` + } + return `\n\n \n \n ${newContent}\n \n \n${tableFooterContent}
\n\n` }, )(contributors) } From d74e2f2ed19817a2858f8b6e04f0454bf80fd079 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 7 Oct 2022 17:14:02 +0800 Subject: [PATCH 26/28] docs: add KnorpelSenf as a contributor for bug (#342) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 7ed5c672..97dc90a9 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -607,6 +607,15 @@ "contributions": [ "code" ] + }, + { + "login": "KnorpelSenf", + "name": "KnorpelSenf", + "avatar_url": "https://avatars.githubusercontent.com/u/12952387?v=4", + "profile": "https://github.com/KnorpelSenf", + "contributions": [ + "bug" + ] } ], "skipCi": true diff --git a/README.md b/README.md index c343b922..fd64bf02 100644 --- a/README.md +++ b/README.md @@ -166,8 +166,18 @@ Thanks goes to these wonderful people Angel Aviel Domaoan
Angel Aviel Domaoan

πŸ’» πŸ‘€ πŸ“– ⚠️ Rambaud Pierrick
Rambaud Pierrick

πŸ’» + KnorpelSenf
KnorpelSenf

πŸ› + + + + + Add your contributions + + + + From fb8f89f1e4d878130367e9a02ce217c3ffb02834 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 7 Oct 2022 17:20:31 +0800 Subject: [PATCH 27/28] docs: add klieret as a contributor for bug (#343) Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com> --- .all-contributorsrc | 8 ++++++++ README.md | 1 + 2 files changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 97dc90a9..3bb30256 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -609,6 +609,14 @@ ] }, { + "login": "klieret", + "name": "Kilian Lieret", + "avatar_url": "https://avatars.githubusercontent.com/u/13602468?v=4", + "profile": "https://www.lieret.net", + "contributions": [ + "bug" + ] + }, "login": "KnorpelSenf", "name": "KnorpelSenf", "avatar_url": "https://avatars.githubusercontent.com/u/12952387?v=4", diff --git a/README.md b/README.md index fd64bf02..ff9d50b8 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,7 @@ Thanks goes to these wonderful people Angel Aviel Domaoan
Angel Aviel Domaoan

πŸ’» πŸ‘€ πŸ“– ⚠️ Rambaud Pierrick
Rambaud Pierrick

πŸ’» + Kilian Lieret
Kilian Lieret

πŸ› KnorpelSenf
KnorpelSenf

πŸ› From 554667bfdd323c79b75e835ac2edd3f371d8945f Mon Sep 17 00:00:00 2001 From: QriLa | Hyeon Gu <68494132+qyurila@users.noreply.github.com> Date: Tue, 11 Oct 2022 05:52:06 +0900 Subject: [PATCH 28/28] feat: Add `width` and `valign` attributes for cleaner (#344) --- .../__tests__/__snapshots__/index.js.snap | 74 +++++++++++++------ src/generate/__tests__/index.js | 15 ++++ src/generate/index.js | 14 +++- 3 files changed, 76 insertions(+), 27 deletions(-) diff --git a/src/generate/__tests__/__snapshots__/index.js.snap b/src/generate/__tests__/__snapshots__/index.js.snap index 33183570..b8f576ac 100644 --- a/src/generate/__tests__/__snapshots__/index.js.snap +++ b/src/generate/__tests__/__snapshots__/index.js.snap @@ -13,9 +13,9 @@ These people contributed to the project: - - - + + +
Kent C. Dodds is awesome!Divjot Singh is awesome!Jeroen Engels is awesome!Kent C. Dodds is awesome!Divjot Singh is awesome!Jeroen Engels is awesome!
@@ -41,9 +41,9 @@ These people contributed to the project: - - - + + + @@ -78,9 +78,9 @@ These people contributed to the project:
Kent C. Dodds is awesome!Divjot Singh is awesome!Jeroen Engels is awesome!Kent C. Dodds is awesome!Divjot Singh is awesome!Jeroen Engels is awesome!
- - - + + +
Kent C. Dodds is awesome!Divjot Singh is awesome!Jeroen Engels is awesome!Kent C. Dodds is awesome!Divjot Singh is awesome!Jeroen Engels is awesome!
@@ -106,15 +106,15 @@ These people contributed to the project: - - - - - + + + + + - - + +
Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!
Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!
@@ -140,15 +140,15 @@ These people contributed to the project: - - - - - + + + + + - - + + @@ -169,3 +169,31 @@ These people contributed to the project: Thanks a lot everyone!" `; + +exports[`validate if cell width attribute is floored correctly 1`] = ` +"# project + +Description + +## Contributors +These people contributed to the project: + + + +
Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!
Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!
+ + + + + + + +
Kent C. Dodds is awesome!Kent C. Dodds is awesome!Kent C. Dodds is awesome!
+ + + + + + +Thanks a lot everyone!" +`; diff --git a/src/generate/__tests__/index.js b/src/generate/__tests__/index.js index 524e58b8..eeb285c2 100644 --- a/src/generate/__tests__/index.js +++ b/src/generate/__tests__/index.js @@ -238,3 +238,18 @@ test('replace all-contributors badge if present', () => { expect(result).toBe(expected) }) + +test('validate if cell width attribute is floored correctly', () => { + const {kentcdodds} = contributors + const {options, content} = fixtures() + const contributorList = [ + kentcdodds, + kentcdodds, + kentcdodds, + ] + + options.contributorsPerLine = 7 + const result = generate(options, contributorList, content) + + expect(result).toMatchSnapshot() +}) diff --git a/src/generate/index.js b/src/generate/index.js index 78de5e36..11eaedb0 100644 --- a/src/generate/index.js +++ b/src/generate/index.js @@ -1,4 +1,5 @@ const _ = require('lodash/fp') +const floor = require('lodash/floor') const formatBadge = require('./format-badge') const formatContributor = require('./format-contributor') @@ -43,9 +44,12 @@ function injectListBetweenTags(newContent) { } } -function formatLine(contributors) { - return `${contributors.join( - '\n ', +function formatLine(options, contributors) { + const width = floor(_.divide(100)(options.contributorsPerLine), 2) + const attributes = `align="center" valign="top" width="${width}%"` + + return `${contributors.join( + `\n `, )}` } @@ -74,7 +78,9 @@ function generateContributorsList(options, contributors) { return formatContributor(options, contributor) }), _.chunk(options.contributorsPerLine), - _.map(formatLine), + _.map((currentLineContributors) => formatLine( + options, currentLineContributors + )), _.join('\n \n \n '), newContent => { if (options.linkToUsage) {