mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 13:36:29 +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
|
yarn.lock
|
||||||
.vscode
|
.vscode
|
||||||
cache
|
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',
|
'Badges',
|
||||||
[
|
[
|
||||||
'[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)',
|
'[![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-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-)',
|
'[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-)\n',
|
||||||
'<!-- ALL-CONTRIBUTORS-BADGE:END -->',
|
'<!-- 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)',
|
'[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)',
|
||||||
].join(''),
|
].join(''),
|
||||||
'',
|
'',
|
||||||
|
@ -157,9 +157,9 @@ test('replace all-contributors badge if present', () => {
|
||||||
'Badges',
|
'Badges',
|
||||||
[
|
[
|
||||||
'[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)',
|
'[![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-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-)',
|
'[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)\n',
|
||||||
'<!-- ALL-CONTRIBUTORS-BADGE:END -->',
|
'<!-- 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)',
|
'[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)',
|
||||||
].join(''),
|
].join(''),
|
||||||
'',
|
'',
|
||||||
|
|
|
@ -81,7 +81,9 @@ function replaceBadge(newContent) {
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
previousContent.slice(0, endOfOpeningTagIndex + closingTag.length),
|
previousContent.slice(0, endOfOpeningTagIndex + closingTag.length),
|
||||||
|
'\n',
|
||||||
newContent,
|
newContent,
|
||||||
|
'\n',
|
||||||
previousContent.slice(startOfClosingTagIndex),
|
previousContent.slice(startOfClosingTagIndex),
|
||||||
].join('')
|
].join('')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue