Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: all-contributors/cli
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.23.1
Choose a base ref
...
head repository: all-contributors/cli
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.24.0
Choose a head ref
  • 3 commits
  • 5 files changed
  • 3 contributors

Commits on Oct 7, 2022

  1. 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>
    allcontributors[bot] authored Oct 7, 2022
    Copy the full SHA
    d74e2f2 View commit details
  2. 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>
    allcontributors[bot] and tenshiAMD authored Oct 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fb8f89f View commit details

Commits on Oct 10, 2022

  1. Copy the full SHA
    554667b View commit details
Showing with 104 additions and 27 deletions.
  1. +17 −0 .all-contributorsrc
  2. +11 −0 README.md
  3. +51 −23 src/generate/__tests__/__snapshots__/index.js.snap
  4. +15 −0 src/generate/__tests__/index.js
  5. +10 −4 src/generate/index.js
17 changes: 17 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -607,6 +607,23 @@
"contributions": [
"code"
]
},
{
"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",
"profile": "https://github.com/KnorpelSenf",
"contributions": [
"bug"
]
}
],
"skipCi": true
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -166,8 +166,19 @@ Thanks goes to these wonderful people
<tr>
<td align="center"><a href="https://tenshiamd.com"><img src="https://avatars.githubusercontent.com/u/13580338?v=4?s=100" width="100px;" alt="Angel Aviel Domaoan"/><br /><sub><b>Angel Aviel Domaoan</b></sub></a><br /><a href="https://github.com/all-contributors/cli/commits?author=tenshiAMD" title="Code">💻</a> <a href="https://github.com/all-contributors/cli/pulls?q=is%3Apr+reviewed-by%3AtenshiAMD" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/all-contributors/cli/commits?author=tenshiAMD" title="Documentation">📖</a> <a href="https://github.com/all-contributors/cli/commits?author=tenshiAMD" title="Tests">⚠️</a></td>
<td align="center"><a href="https://12rambau.github.io/web-resume/"><img src="https://avatars.githubusercontent.com/u/12596392?v=4?s=100" width="100px;" alt="Rambaud Pierrick"/><br /><sub><b>Rambaud Pierrick</b></sub></a><br /><a href="https://github.com/all-contributors/cli/commits?author=12rambau" title="Code">💻</a></td>
<td align="center"><a href="https://www.lieret.net"><img src="https://avatars.githubusercontent.com/u/13602468?v=4?s=100" width="100px;" alt="Kilian Lieret"/><br /><sub><b>Kilian Lieret</b></sub></a><br /><a href="https://github.com/all-contributors/cli/issues?q=author%3Aklieret" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/KnorpelSenf"><img src="https://avatars.githubusercontent.com/u/12952387?v=4?s=100" width="100px;" alt="KnorpelSenf"/><br /><sub><b>KnorpelSenf</b></sub></a><br /><a href="https://github.com/all-contributors/cli/issues?q=author%3AKnorpelSenf" title="Bug reports">🐛</a></td>
</tr>
</tbody>
<tfoot>
<tr>
<td align="center" size="13px" colspan="6">
<img src="https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg">
<a href="https://all-contributors.js.org/docs/en/bot/usage">Add your contributions</a>
</img>
</td>
</tr>
</tfoot>
</table>

<!-- markdownlint-restore -->
74 changes: 51 additions & 23 deletions src/generate/__tests__/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
@@ -13,9 +13,9 @@ These people contributed to the project:
<table>
<tbody>
<tr>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Divjot Singh is awesome!</td>
<td align=\\"center\\">Jeroen Engels is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Divjot Singh is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Jeroen Engels is awesome!</td>
</tr>
</tbody>
</table>
@@ -41,9 +41,9 @@ These people contributed to the project:
<table>
<tbody>
<tr>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Divjot Singh is awesome!</td>
<td align=\\"center\\">Jeroen Engels is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Divjot Singh is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Jeroen Engels is awesome!</td>
</tr>
</tbody>
<tfoot>
@@ -78,9 +78,9 @@ These people contributed to the project:
<table>
<tbody>
<tr>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Divjot Singh is awesome!</td>
<td align=\\"center\\">Jeroen Engels is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Divjot Singh is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Jeroen Engels is awesome!</td>
</tr>
</tbody>
</table>
@@ -106,15 +106,15 @@ These people contributed to the project:
<table>
<tbody>
<tr>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
</tr>
<tr>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
</tr>
</tbody>
</table>
@@ -140,15 +140,15 @@ These people contributed to the project:
<table>
<tbody>
<tr>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
</tr>
<tr>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"20%\\">Kent C. Dodds is awesome!</td>
</tr>
</tbody>
<tfoot>
@@ -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:
<!-- ALL-CONTRIBUTORS-LIST:START -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align=\\"center\\" valign=\\"top\\" width=\\"14.28%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"14.28%\\">Kent C. Dodds is awesome!</td>
<td align=\\"center\\" valign=\\"top\\" width=\\"14.28%\\">Kent C. Dodds is awesome!</td>
</tr>
</tbody>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
Thanks a lot everyone!"
`;
15 changes: 15 additions & 0 deletions src/generate/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -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()
})
14 changes: 10 additions & 4 deletions src/generate/index.js
Original file line number Diff line number Diff line change
@@ -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 `<td align="center">${contributors.join(
'</td>\n <td align="center">',
function formatLine(options, contributors) {
const width = floor(_.divide(100)(options.contributorsPerLine), 2)
const attributes = `align="center" valign="top" width="${width}%"`

return `<td ${attributes}>${contributors.join(
`</td>\n <td ${attributes}>`,
)}</td>`
}

@@ -74,7 +78,9 @@ function generateContributorsList(options, contributors) {
return formatContributor(options, contributor)
}),
_.chunk(options.contributorsPerLine),
_.map(formatLine),
_.map((currentLineContributors) => formatLine(
options, currentLineContributors
)),
_.join('\n </tr>\n <tr>\n '),
newContent => {
if (options.linkToUsage) {