Skip to content

Commit 522057e

Browse files
authored
Update generate.py
Remove debug logs
1 parent bdee1c2 commit 522057e

File tree

1 file changed

+2
-29
lines changed

1 file changed

+2
-29
lines changed

β€Žscripts/generate.pyβ€Ž

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import yaml
22
import re
33
import os
4-
import difflib
54

65
# -----------------------
76
# Load YAML data
87
# -----------------------
98
with open('data/plugins-and-themes.yml', 'r') as f:
109
data = yaml.safe_load(f)
11-
print(f"Loaded {len(data.get('plugins', []))} plugins and {len(data.get('themes', []))} themes.")
1210

1311
# -----------------------
1412
# Markdown generator for each plugin/theme entry
@@ -17,7 +15,6 @@ def generate_entry_md(entry, is_plugin=True, index=0):
1715
owner, repo_name = entry['repo'].split('/')
1816
sanitized_name = entry['name'].replace(' ', '%20')
1917

20-
# Title + Badges (only once)
2118
md = f"- ### [{entry['name']}](https://github.com/{entry['repo']}) <br>\n"
2219
md += f" [![Latest Release Date](https://img.shields.io/github/release-date/{entry['repo']}?label=Latest%20Release&color=green)](https://github.com/{entry['repo']}/releases) "
2320
md += f"[![GitHub Downloads](https://img.shields.io/github/downloads/{entry['repo']}/total)](https://github.com/{entry['repo']}/releases/download/{entry.get('latest_release_tag', 'latest')}/{sanitized_name}.jar)<br>\n"
@@ -53,7 +50,6 @@ def generate_entry_md(entry, is_plugin=True, index=0):
5350
# -----------------------
5451
plugin_count = len(data.get("plugins", []))
5552
theme_count = len(data.get("themes", []) or [])
56-
print(f"Plugin count: {plugin_count}, Theme count: {theme_count}")
5753

5854
# -----------------------
5955
# Update PLUGINS.md
@@ -72,7 +68,6 @@ def generate_entry_md(entry, is_plugin=True, index=0):
7268

7369
with open('PLUGINS.md', 'w') as f:
7470
f.write(plugins_content)
75-
print("βœ… Updated PLUGINS.md")
7671

7772
# -----------------------
7873
# Update THEMES.md
@@ -91,24 +86,13 @@ def generate_entry_md(entry, is_plugin=True, index=0):
9186

9287
with open('THEMES.md', 'w') as f:
9388
f.write(themes_content)
94-
print("βœ… Updated THEMES.md")
9589

9690
# -----------------------
97-
# Update badge counts in README.md (flexible)
91+
# Update badge counts in README.md
9892
# -----------------------
99-
print("πŸ“ Working directory:", os.getcwd())
100-
print("πŸ“„ README.md path:", os.path.abspath('README.md'))
101-
10293
with open('README.md', 'r') as f:
10394
readme_original = f.read()
10495

105-
# Check for matches
106-
plugin_match = re.search(r'\[!\[Plugins\]\(.*?shields\.io/badge/Plugins-\d+-green.*?\)\]\([^)]+\)', readme_original)
107-
theme_match = re.search(r'\[!\[Themes\]\(.*?shields\.io/badge/Themes-\d+-green.*?\)\]\([^)]+\)', readme_original)
108-
print("πŸ” Plugin badge found:", bool(plugin_match))
109-
print("πŸ” Theme badge found:", bool(theme_match))
110-
111-
# Apply replacements
11296
readme_updated = re.sub(
11397
r'\[!\[Plugins\]\(.*?shields\.io/badge/Plugins-\d+-green.*?\)\]\([^)]+\)',
11498
f'[![Plugins](https://img.shields.io/badge/Plugins-{plugin_count}-green)](./PLUGINS.md)',
@@ -123,17 +107,6 @@ def generate_entry_md(entry, is_plugin=True, index=0):
123107
count=1
124108
)
125109

126-
# Diff check
127-
if readme_original == readme_updated:
128-
print("βœ… README.md was already up to date.")
129-
else:
130-
print("✏️ README.md was changed. Writing changes...")
110+
if readme_original != readme_updated:
131111
with open('README.md', 'w') as f:
132112
f.write(readme_updated)
133-
print("βœ… README.md updated.")
134-
print("--- README.md DIFF ---")
135-
for line in difflib.unified_diff(readme_original.splitlines(), readme_updated.splitlines(), fromfile='before', tofile='after', lineterm=''):
136-
print(line)
137-
print("--- END DIFF ---")
138-
139-
print("πŸ•’ README.md last modified:", os.path.getmtime('README.md'))

0 commit comments

Comments
Β (0)