Skip to content

Commit

Permalink
fix: fix badge replacement (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebolam committed Dec 9, 2019
1 parent 3382821 commit dbb05a4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ package-lock.json
yarn.lock
.vscode
cache
.idea
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.14.0
8.16.0
12 changes: 6 additions & 6 deletions src/generate/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ test('replace all-contributors badge if present', () => {
'Badges',
[
'[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)',
'<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->',
'[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-)',
'<!-- ALL-CONTRIBUTORS-BADGE:END -->',
'<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n',
'[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-)\n',
'<!-- ALL-CONTRIBUTORS-BADGE:END -->\n',
'[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)',
].join(''),
'',
Expand All @@ -157,9 +157,9 @@ test('replace all-contributors badge if present', () => {
'Badges',
[
'[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)',
'<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->',
'[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)',
'<!-- ALL-CONTRIBUTORS-BADGE:END -->',
'<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n',
'[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)\n',
'<!-- ALL-CONTRIBUTORS-BADGE:END -->\n',
'[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)',
].join(''),
'',
Expand Down
2 changes: 2 additions & 0 deletions src/generate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ function replaceBadge(newContent) {
}
return [
previousContent.slice(0, endOfOpeningTagIndex + closingTag.length),
'\n',
newContent,
'\n',
previousContent.slice(startOfClosingTagIndex),
].join('')
}
Expand Down

0 comments on commit dbb05a4

Please sign in to comment.