mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-23 00:59:22 -05:00
added stylisher badges
This commit is contained in:
parent
b3f0cb799a
commit
4cabc25ec5
3 changed files with 15 additions and 2 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -26,6 +26,8 @@ jobs:
|
|||
components: rustfmt
|
||||
- name: Cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
- name: Check function count badge
|
||||
run: python3 docs/generate_count_badge.py --check
|
||||
- name: Check formatting
|
||||
run: cargo fmt --check
|
||||
# - name: Check if the README is up to date.
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<p align="center">
|
||||
<a href="https://crates.io/crates/leptos-use"><img src="https://img.shields.io/crates/v/leptos-use.svg?label=&color=%232C1275" alt="Crates.io"/></a>
|
||||
<a href="https://leptos-use.rs"><img src="https://img.shields.io/badge/-docs%20%26%20demos-%239A233F" alt="Docs & Demos"></a>
|
||||
<a href="https://leptos-use.rs"><img src="https://img.shields.io/badge/-23%20functions-%23EF3939" alt="23 Functions" /></a>
|
||||
<a href="https://leptos-use.rs"><img src="https://img.shields.io/badge/-22%20functions-%23EF3939" alt="23 Functions" /></a>
|
||||
</p>
|
||||
|
||||
<br/>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
def main():
|
||||
count = 0
|
||||
|
@ -13,12 +14,22 @@ def main():
|
|||
print(f"Found {count} functions")
|
||||
|
||||
with open("README.md", "r") as f:
|
||||
original_text = f.read()
|
||||
text = re.sub(
|
||||
r'<img src="https://img.shields.io/badge/-\d+%20functions-%23EF3939" alt="\d+ Functions"',
|
||||
f'<img src="https://img.shields.io/badge/-{count}%20functions-%23EF3939" alt="{count} Functions"',
|
||||
f.read()
|
||||
original_text
|
||||
)
|
||||
|
||||
if sys.argv[1] == "--check":
|
||||
if original_text != text:
|
||||
print("[Failed] README.md doesn't have the correct function count badge", file=sys.stderr)
|
||||
print(" * Run `python3 docs/generate_count_badge.py` to fix", file=sys.stderr)
|
||||
quit(1)
|
||||
else:
|
||||
print("[OK] README.md has the correct function count badge")
|
||||
quit(0)
|
||||
|
||||
with open("README.md", "w") as f:
|
||||
f.write(text)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue