mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-08 05:06:23 +00:00
fix: fix badge replacement (#232)
This commit is contained in:
parent
3382821641
commit
dbb05a4dd8
4 changed files with 10 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -12,3 +12,4 @@ package-lock.json
|
|||
yarn.lock
|
||||
.vscode
|
||||
cache
|
||||
.idea
|
||||
|
|
2
.nvmrc
2
.nvmrc
|
@ -1 +1 @@
|
|||
8.14.0
|
||||
8.16.0
|
||||
|
|
|
@ -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(''),
|
||||
'',
|
||||
|
@ -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(''),
|
||||
'',
|
||||
|
|
|
@ -81,7 +81,9 @@ function replaceBadge(newContent) {
|
|||
}
|
||||
return [
|
||||
previousContent.slice(0, endOfOpeningTagIndex + closingTag.length),
|
||||
'\n',
|
||||
newContent,
|
||||
'\n',
|
||||
previousContent.slice(startOfClosingTagIndex),
|
||||
].join('')
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue