all-contributors-cli
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -21,3 +21,3 @@ 'use strict'; | ||
return previousContent.slice(0, endOfOpeningTagIndex + closingTag.length) + | ||
'\n' + newContent + '\n' + | ||
newContent + | ||
previousContent.slice(startOfClosingTagIndex); | ||
@@ -47,3 +47,6 @@ }; | ||
}, | ||
_.join('\n') | ||
_.join('\n'), | ||
function (newContent) { | ||
return '\n' + newContent + '\n'; | ||
} | ||
)(contributors); | ||
@@ -65,3 +68,3 @@ } | ||
module.exports = function generate(options, contributors, fileContent) { | ||
var contributorsList = generateContributorsList(options, contributors); | ||
var contributorsList = contributors.length === 0 ? '\n' : generateContributorsList(options, contributors); | ||
var badge = formatBadge(options, contributors); | ||
@@ -68,0 +71,0 @@ return _.flow( |
@@ -139,2 +139,23 @@ import test from 'ava'; | ||
test('should inject nothing if there are no contributors', t => { | ||
const {options, content} = fixtures(); | ||
const contributorList = []; | ||
const expected = [ | ||
'# project', | ||
'', | ||
'Description', | ||
'', | ||
'## Contributors', | ||
'These people contributed to the project:', | ||
'<!-- ALL-CONTRIBUTORS-LIST:START -->', | ||
'<!-- ALL-CONTRIBUTORS-LIST:END -->', | ||
'', | ||
'Thanks a lot guys!' | ||
].join('\n'); | ||
const result = generate(options, contributorList, content); | ||
t.is(result, expected); | ||
}); | ||
test('should replace all-contributors badge if present', t => { | ||
@@ -141,0 +162,0 @@ const {kentcdodds} = contributors; |
@@ -7,3 +7,3 @@ 'use strict'; | ||
var commitTemplate = '<%= (newContributor ? "Add" : "Update") %> <%= username %> as a contributor'; | ||
var commitTemplate = '<%= (newContributor ? "Add" : "Update") %> @<%= username %> as a contributor'; | ||
@@ -10,0 +10,0 @@ function getRemoteOriginData(cb) { |
{ | ||
"name": "all-contributors-cli", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "Tool to easily add recognition for new contributors", | ||
@@ -5,0 +5,0 @@ "bin": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45867
1239