Moved data files into static and dynamic

This commit is contained in:
Lucas
2025-10-16 13:57:14 -07:00
parent 4e56301dfb
commit 0beb55ffed
15 changed files with 21 additions and 21 deletions

View File

@@ -19,7 +19,7 @@ To establish uniformity accross the project, please adhere to these conventions.
- Use the project's official name, not the repository name. Repository names often use lowercase and place dashes in place of spaces. Fallback to **Title Casing** if capitalization is not clear.
- For projects with multiple repositories (EX: one for IOS, Windows, etc) link the repository with the most stars.
- Do not put in a description unless the repo description is inadequate or non-existent, in which case fall back to the organization, their website, or the repo's README. **Do not write your own description, only use text from official sources of the project, and do not modify (EX: shorten) their description.** If you use a custom description make sure to put in the `custom-description` flag so that the stat updator script doesn't overide it.
- For tags, do not use the emoji. Go to [tags.json](source/data/tags.json) and find the id for the tag. Our script will generate it's corresponding emoji when it builds the README.
- For tags, do not use the emoji. Go to [tags.json](source/data/static/tags.json) and find the id for the tag. Our script will generate it's corresponding emoji when it builds the README.
## How To Contribute
[How to create a pull request.](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)

View File

@@ -40,6 +40,6 @@ jobs:
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add source/data/applications.json
git add source/data/dynamic/applications.json
git commit -m "Auto-update GitHub metadata" || echo "No changes to commit"
git push

View File

@@ -19,9 +19,9 @@ The place that connects everything related to definitive-opensource.
- [source/scripts/maintenance](source/scripts/maintenance) - Contains scripts related to maintenance
## Data
- [applications.json](source/data/applications.json) - Stores all information related to applications
- [categories.json](source/data/categories.json) - Declares categories and subcategories
- [tags](source/data/tags.json) - Declares tags, their id, and corresponding emoji
- [applications.json](source/data/dynamic/applications.json) - Stores all information related to applications
- [categories.json](source/data/static/categories.json) - Declares categories and subcategories
- [tags](source/data/static/tags.json) - Declares tags, their id, and corresponding emoji
## GitHub Actions
- [generate-readme.yml](.github/workflows/generate-readme.yml) - Calls the [`readme_generator.py`](source/scripts/generation/readme_generator.py) to generate READMEs

View File

@@ -3,7 +3,7 @@
Here's a look at how the "backend" of the list works.
## README Generation
All applications are stored inside [`applications.json`](source/data/applications.json). Categories are declared inside [`categories.json`](source/data/categories.json). Instead of a nested format with subcategories as on object of it's parent, we've given subcategories a `parent` attribute. There's also a [`tags.json`](source/data/tags.json). Instead of putting the emoji inside of the ```tags``` attribute in `applications.json`, the id is used, for example, `commercial` or `disruptive`.. These id's are mapped to their corresponding emoji for when the READMEs are generated and makes``applications.json``` more readable.
All applications are stored inside [`applications.json`](source/data/dynamic/applications.json). Categories are declared inside [`categories.json`](source/data/static/categories.json). Instead of a nested format with subcategories as on object of it's parent, we've given subcategories a `parent` attribute. There's also a [`tags.json`](source/data/static/tags.json). Instead of putting the emoji inside of the ```tags``` attribute in `applications.json`, the id is used, for example, `commercial` or `disruptive`.. These id's are mapped to their corresponding emoji for when the READMEs are generated and makes``applications.json``` more readable.
The generation scripts are inside of the [`source/scripts/generation`](source/scripts/generation) directory. [`mainheader_generator.py`](source/scripts/generation/mainheader_generator.py) generates the very top header with the dynamic project count. Then, depending on the platform being generating, it inserts [`header.md`](source/components/header.md), [`macosheader.md`](source/components/macosheader.md), etc.
@@ -14,4 +14,4 @@ The generation scripts are inside of the [`source/scripts/generation`](source/sc
Lastly [`readme_generator.py`](source/scripts/generation/readme_generator.py) brings everything together, calling the other scripts to generate one main list, and more for several platforms.
## Maintenence
[`applications.json`](source/data/applications.json) stores a lot of information that the README does not display such as last commit, language, and license. These are for a future web version of the list that would pull data from the json file. [`stats_updator.py`](source/maintenance/stats_updator.py) runs every midnight and updates all application stats. Each application object in the json file also has a `flags` attribute. For example, the `custom-description` flag tells the stats_updator script to skip updating the description for that app. For more into on flags, consult the [`DOCS.md`](resources/DOCS.md)
[`applications.json`](source/data/dynamic/applications.json) stores a lot of information that the README does not display such as last commit, language, and license. These are for a future web version of the list that would pull data from the json file. [`stats_updator.py`](source/maintenance/stats_updator.py) runs every midnight and updates all application stats. Each application object in the json file also has a `flags` attribute. For example, the `custom-description` flag tells the stats_updator script to skip updating the description for that app. For more into on flags, consult the [`DOCS.md`](resources/DOCS.md)

View File

@@ -41,13 +41,13 @@ def format_stars(n):
def generate_contents(platform="all"):
with open("source/data/categories.json", "r", encoding="utf-8") as f:
with open("source/data/static/categories.json", "r", encoding="utf-8") as f:
cat_data = json.load(f)
with open("source/data/applications.json", "r", encoding="utf-8") as f:
with open("source/data/dynamic/applications.json", "r", encoding="utf-8") as f:
app_data = json.load(f)
with open("source/data/tags.json", "r", encoding="utf-8") as f:
with open("source/data/static/tags.json", "r", encoding="utf-8") as f:
tags_data = json.load(f)
with open("source/data/platforms.json", "r", encoding="utf-8") as f:
with open("source/data/static/platforms.json", "r", encoding="utf-8") as f:
platforms_data = json.load(f)
categories = cat_data.get("categories", [])

View File

@@ -2,7 +2,7 @@ import json
# Generates mainheader with dynamic project count
def generate_mainheader():
with open("source/data/applications.json", "r", encoding="utf-8") as f:
with open("source/data/dynamic/applications.json", "r", encoding="utf-8") as f:
data = json.load(f)
project_count = len(data.get("applications", []))

View File

@@ -6,7 +6,7 @@ def slugify(name):
def generate_table_of_contents():
# Load the categories JSON data
with open("source/data/categories.json", "r", encoding="utf-8") as f:
with open("source/data/static/categories.json", "r", encoding="utf-8") as f:
data = json.load(f)
categories = data.get("categories", [])
subcategories = data.get("subcategories", [])

View File

@@ -3,7 +3,7 @@ import requests
import json
from datetime import datetime
with open('source/data/applications.json', 'r') as f:
with open('source/data/dynamic/applications.json', 'r') as f:
data = json.load(f)
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
@@ -56,7 +56,7 @@ def update_application_data(app):
for app in data['applications']:
app = update_application_data(app)
with open('source/data/applications.json', 'w') as f:
with open('source/data/dynamic/applications.json', 'w') as f:
json.dump(data, f, indent=4)
print("Updated application data successfully!")

View File

@@ -3,7 +3,7 @@ import json
"""
# Load the JSON data from file
with open("source/data/applications.json", "r", encoding="utf-8") as file:
with open("source/data/dynamic/applications.json", "r", encoding="utf-8") as file:
data = json.load(file)
# Convert all platform entries to lowercase
@@ -12,7 +12,7 @@ for app in data.get("applications", []):
app["platforms"] = [platform.lower() for platform in app["platforms"]]
# Write the modified data back to the file
with open("source/data/applications.json", "w", encoding="utf-8") as file:
with open("source/data/dynamic/applications.json", "w", encoding="utf-8") as file:
json.dump(data, file, indent=4)
print("All platform entries have been converted to lowercase.")
@@ -20,7 +20,7 @@ print("All platform entries have been converted to lowercase.")
"""
# Load the JSON file
with open("source/data/applications.json", "r", encoding="utf-8") as file:
with open("source/data/dynamic/applications.json", "r", encoding="utf-8") as file:
data = json.load(file)
# Add "flags" and "stars" properties to each application
@@ -28,14 +28,14 @@ for app in data.get("applications", []):
app["homepage_url"] = ""
# Save the updated JSON back to the file
with open("source/data/applications.json", "w", encoding="utf-8") as file:
with open("source/data/dynamic/applications.json", "w", encoding="utf-8") as file:
json.dump(data, file, indent=4, ensure_ascii=False)
print("Operation successful: applications.json updated")
"""
# Load applications.json
with open("source/data/applications.json", "r", encoding="utf-8") as f:
with open("source/data/dynamic/applications.json", "r", encoding="utf-8") as f:
data = json.load(f)
# Platforms to check for
@@ -58,5 +58,5 @@ for app in data.get("applications", []):
app["tags"] = sorted(tags)
# Save the updated file
with open("source/data/applications.json", "w", encoding="utf-8") as f:
with open("source/data/dynamic/applications.json", "w", encoding="utf-8") as f:
json.dump(data, f, indent=4)