Skip to content

Commit

Permalink
feat: update views badge
Browse files Browse the repository at this point in the history
  • Loading branch information
toFrankie committed Aug 11, 2024
1 parent fb3f68b commit d691ea9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 18 deletions.
26 changes: 18 additions & 8 deletions docs/badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 18 additions & 8 deletions docs/templates/badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion docs/templates/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

> 技术日新月异,文章内容或已过时,阅读时请细心斟酌。
> ![](../badge.svg)
### 我的文章

{{yearLinks}}
Expand Down Expand Up @@ -62,4 +64,5 @@
- [Standard Method Name Verb Semantics](https://chrisoldwood.blogspot.com/2009/11/standard-method-name-verb-semantics.html)
- [Naming guidelines for boolean variables](https://www.serendipidata.com/posts/naming-guidelines-for-boolean-variables)
- [Tips on naming boolean variables - Cleaner Code](https://dev.to/michi/tips-on-naming-boolean-variables-cleaner-code-35ig)
- [How to Name Booleans Values](https://prasannakumar8332.medium.com/auxiliary-name-the-booleans-ed954fa9f3c6)
- [How to Name Booleans Values](https://prasannakumar8332.medium.com/auxiliary-name-the-booleans-ed954fa9f3c6)

2 changes: 1 addition & 1 deletion scripts/update-badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function updateBadge(templatePath, outputPath, newCount) {
const originalBadgeContent = await fs.readFile(outputPath, 'utf8')

const templateBadgeContent = await fs.readFile(templatePath, 'utf8')
const currentBadgeContent = templateBadgeContent.replace(/{{count}}/, newCount)
const currentBadgeContent = templateBadgeContent.replace(/{{views}}/, newCount)

if (currentBadgeContent !== originalBadgeContent) {
await fs.writeFile(outputPath, currentBadgeContent, 'utf8')
Expand Down

0 comments on commit d691ea9

Please sign in to comment.