diff --git a/src/generate/__tests__/__snapshots__/index.js.snap b/src/generate/__tests__/__snapshots__/index.js.snap
index 7278f00..3318357 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 cff3f7c..524e58b 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 6dac425..78de5e3 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)
}