From 0beb55ffed5989565657afbc0f291fee652da2fc Mon Sep 17 00:00:00 2001 From: Lucas <169063936+mustbeperfect@users.noreply.github.com> Date: Thu, 16 Oct 2025 13:57:14 -0700 Subject: [PATCH] Moved data files into static and dynamic --- .github/CONTRIBUTING.md | 2 +- .github/workflows/update-stats.yml | 2 +- resources/PORTAL.md | 6 +++--- resources/dev/ARCHITECTURE.md | 4 ++-- source/data/{ => dynamic}/applications.json | 0 source/data/{ => static}/archive.json | 0 source/data/{ => static}/categories.json | 0 source/data/{ => static}/platforms.json | 0 source/data/{ => static}/project.json | 0 source/data/{ => static}/tags.json | 0 source/scripts/generation/contents_generator.py | 8 ++++---- source/scripts/generation/mainheader_generator.py | 2 +- .../scripts/generation/tableofcontents_generator.py | 2 +- source/scripts/maintenance/stats_updator.py | 4 ++-- source/scripts/utils/json_mod.py | 12 ++++++------ 15 files changed, 21 insertions(+), 21 deletions(-) rename source/data/{ => dynamic}/applications.json (100%) rename source/data/{ => static}/archive.json (100%) rename source/data/{ => static}/categories.json (100%) rename source/data/{ => static}/platforms.json (100%) rename source/data/{ => static}/project.json (100%) rename source/data/{ => static}/tags.json (100%) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8303cf4..884ae1a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -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) diff --git a/.github/workflows/update-stats.yml b/.github/workflows/update-stats.yml index 9172c75..ab7e77c 100644 --- a/.github/workflows/update-stats.yml +++ b/.github/workflows/update-stats.yml @@ -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 diff --git a/resources/PORTAL.md b/resources/PORTAL.md index 942a499..a79524c 100644 --- a/resources/PORTAL.md +++ b/resources/PORTAL.md @@ -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 diff --git a/resources/dev/ARCHITECTURE.md b/resources/dev/ARCHITECTURE.md index b24af34..b911ba1 100644 --- a/resources/dev/ARCHITECTURE.md +++ b/resources/dev/ARCHITECTURE.md @@ -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) \ No newline at end of file +[`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) \ No newline at end of file diff --git a/source/data/applications.json b/source/data/dynamic/applications.json similarity index 100% rename from source/data/applications.json rename to source/data/dynamic/applications.json diff --git a/source/data/archive.json b/source/data/static/archive.json similarity index 100% rename from source/data/archive.json rename to source/data/static/archive.json diff --git a/source/data/categories.json b/source/data/static/categories.json similarity index 100% rename from source/data/categories.json rename to source/data/static/categories.json diff --git a/source/data/platforms.json b/source/data/static/platforms.json similarity index 100% rename from source/data/platforms.json rename to source/data/static/platforms.json diff --git a/source/data/project.json b/source/data/static/project.json similarity index 100% rename from source/data/project.json rename to source/data/static/project.json diff --git a/source/data/tags.json b/source/data/static/tags.json similarity index 100% rename from source/data/tags.json rename to source/data/static/tags.json diff --git a/source/scripts/generation/contents_generator.py b/source/scripts/generation/contents_generator.py index 1c6786e..14be96d 100644 --- a/source/scripts/generation/contents_generator.py +++ b/source/scripts/generation/contents_generator.py @@ -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", []) diff --git a/source/scripts/generation/mainheader_generator.py b/source/scripts/generation/mainheader_generator.py index 0acbda4..6fe8a76 100644 --- a/source/scripts/generation/mainheader_generator.py +++ b/source/scripts/generation/mainheader_generator.py @@ -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", [])) diff --git a/source/scripts/generation/tableofcontents_generator.py b/source/scripts/generation/tableofcontents_generator.py index eff375d..0b6850c 100644 --- a/source/scripts/generation/tableofcontents_generator.py +++ b/source/scripts/generation/tableofcontents_generator.py @@ -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", []) diff --git a/source/scripts/maintenance/stats_updator.py b/source/scripts/maintenance/stats_updator.py index ce788d2..31b71cb 100644 --- a/source/scripts/maintenance/stats_updator.py +++ b/source/scripts/maintenance/stats_updator.py @@ -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!") diff --git a/source/scripts/utils/json_mod.py b/source/scripts/utils/json_mod.py index 3beba32..dabee5b 100644 --- a/source/scripts/utils/json_mod.py +++ b/source/scripts/utils/json_mod.py @@ -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)