mirror of
https://github.com/mustbeperfect/definitive-opensource.git
synced 2026-04-20 07:54:23 +02:00
Full rework of tag and platform system
This commit is contained in:
@@ -44,11 +44,16 @@
|
||||
|
||||
`Mobile` - Android and IOS
|
||||
|
||||
`Windows`, `MacOS`, `Linux`, `Android`, `IOS`, `SelfHost`, `Web (Cloud)`, `VSCode`, `JetBrains`, `Chromium`, `Firefox`, `N/A`
|
||||
|
||||
### Properties
|
||||
`CLI+` - CLI in addition to GUI
|
||||
|
||||
`TUI` - Terminal user interface
|
||||
|
||||
`Windows`, `MacOS`, `Linux`, `Android`, `IOS`, `CLI`, `SelfHost`, `Web (Cloud)`, `VSCode`, `JetBrains`, `Chromium`, `Firefox`, `Plugin`, `Extension`, `pip`, `npm`, `N/A`
|
||||
`Manual` - Installation with pip, npm, cargo, building from source
|
||||
|
||||
`CLI`, `Plugin`, `Extension`, `Web UI`
|
||||
|
||||
> [!NOTE]
|
||||
> `Cross`, `MacOS`, `Linux`, and `Windows` platform tags refers to apps with an executable or binary, EX: exe and dmg (with the exception of CLI apps). `Selfhosted` apps are often inherently cross platform via docker desktop but they aren't labeled as such. The same goes for apps installed via `pip` and `npm`. A few apps blur the lines with convoluted options to install/ This is prevalent in AI apps. These can have misleading platform tags - we are working on a solution.
|
||||
> Cross, MacOS, Linux, and Windows tags, by default, imply that the app ships as a binary (EX: exe, dmg) unless they are accompanied by the `manual` tag that indicates another runtime or installation method.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,23 +5,7 @@
|
||||
"name": "Cross",
|
||||
"id": "cross"
|
||||
},
|
||||
{
|
||||
"name": "Mobile",
|
||||
"id": "mobile"
|
||||
},
|
||||
{
|
||||
"name": "CLI+",
|
||||
"id": "cli-plus"
|
||||
},
|
||||
{
|
||||
"name": "CLI",
|
||||
"id": "cli"
|
||||
},
|
||||
{
|
||||
"name": "TUI",
|
||||
"id": "tui"
|
||||
},
|
||||
{
|
||||
{
|
||||
"name": "Windows",
|
||||
"id": "windows"
|
||||
},
|
||||
@@ -33,14 +17,6 @@
|
||||
"name": "Linux",
|
||||
"id": "linux"
|
||||
},
|
||||
{
|
||||
"name": "Android",
|
||||
"id": "android"
|
||||
},
|
||||
{
|
||||
"name": "IOS",
|
||||
"id": "ios"
|
||||
},
|
||||
{
|
||||
"name": "SelfHost",
|
||||
"id": "selfhost"
|
||||
@@ -50,13 +26,25 @@
|
||||
"id": "web-cloud"
|
||||
},
|
||||
{
|
||||
"name": "VSCode",
|
||||
"id": "vscode"
|
||||
"name": "Mobile",
|
||||
"id": "mobile"
|
||||
},
|
||||
{
|
||||
"name": "Android",
|
||||
"id": "android"
|
||||
},
|
||||
{
|
||||
"name": "IOS",
|
||||
"id": "ios"
|
||||
},
|
||||
{
|
||||
"name": "JetBrains",
|
||||
"id": "jetbrains"
|
||||
},
|
||||
{
|
||||
"name": "VSCode",
|
||||
"id": "vscode"
|
||||
},
|
||||
{
|
||||
"name": "Chromium",
|
||||
"id": "chromium"
|
||||
@@ -65,26 +53,6 @@
|
||||
"name": "Firefox",
|
||||
"id": "firefox"
|
||||
},
|
||||
{
|
||||
"name": "Plugin",
|
||||
"id": "plugin"
|
||||
},
|
||||
{
|
||||
"name": "Extension",
|
||||
"id": "extension"
|
||||
},
|
||||
{
|
||||
"name": "pip",
|
||||
"id": "pip"
|
||||
},
|
||||
{
|
||||
"name": "npm",
|
||||
"id": "npm"
|
||||
},
|
||||
{
|
||||
"name": "Docker",
|
||||
"id": "docker"
|
||||
},
|
||||
{
|
||||
"name": "N/A",
|
||||
"id": "n/a"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"tags":
|
||||
"attributes":
|
||||
[
|
||||
{
|
||||
"emoji": "🟡",
|
||||
@@ -91,5 +91,36 @@
|
||||
"id": "innovative",
|
||||
"description": "Innovative"
|
||||
}
|
||||
],
|
||||
"properties":
|
||||
[
|
||||
{
|
||||
"name": "CLI+",
|
||||
"id": "cli-plus"
|
||||
},
|
||||
{
|
||||
"name": "CLI",
|
||||
"id": "cli"
|
||||
},
|
||||
{
|
||||
"name": "TUI",
|
||||
"id": "tui"
|
||||
},
|
||||
{
|
||||
"name": "Web UI",
|
||||
"id": "web-ui"
|
||||
},
|
||||
{
|
||||
"name": "Manual",
|
||||
"id": "manual"
|
||||
},
|
||||
{
|
||||
"name": "Plugin",
|
||||
"id": "plugin"
|
||||
},
|
||||
{
|
||||
"name": "Extension",
|
||||
"id": "extension"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -55,7 +55,8 @@ def generate_contents(platform="all"):
|
||||
applications = app_data.get("applications", [])
|
||||
|
||||
parent_map = {cat["id"]: cat["name"] for cat in categories}
|
||||
tag_map = {tag["id"]: tag["emoji"] for tag in tags_data["tags"]}
|
||||
attribute_map = {attribute["id"]: attribute["emoji"] for attribute in tags_data["attributes"]}
|
||||
property_map = {property["id"]: property["name"] for property in tags_data["properties"]}
|
||||
platform_map = {p["id"]: p["name"] for p in platforms_data["platforms"]}
|
||||
|
||||
subcat_by_parent = {}
|
||||
@@ -82,7 +83,6 @@ def generate_contents(platform="all"):
|
||||
if target in app_platforms:
|
||||
include = True
|
||||
|
||||
|
||||
if target in ["macos", "linux", "windows"] and "cross" in app_platforms:
|
||||
include = True
|
||||
if not include:
|
||||
@@ -90,11 +90,9 @@ def generate_contents(platform="all"):
|
||||
|
||||
cat_id = app.get("category", "uncategorized")
|
||||
apps_by_subcat.setdefault(cat_id, []).append(app)
|
||||
|
||||
|
||||
for key in apps_by_subcat:
|
||||
apps_by_subcat[key].sort(key=lambda x: x["name"].lower())
|
||||
|
||||
|
||||
md_output = ""
|
||||
|
||||
@@ -109,7 +107,7 @@ def generate_contents(platform="all"):
|
||||
for sub in subcat_by_parent.get(pid, []):
|
||||
subname = sub["Name"]
|
||||
md_output += f"### {subname}\n\n"
|
||||
md_output += "| Name | Description | Platform | Stars |\n"
|
||||
md_output += "| Name | Description | Platform(s) | Stars |\n"
|
||||
md_output += "| --- | --- | --- | --- |\n"
|
||||
|
||||
apps = apps_by_subcat.get(sub["id"], [])
|
||||
@@ -117,13 +115,16 @@ def generate_contents(platform="all"):
|
||||
name = app.get("name", "")
|
||||
description = app.get("description", "").replace("|", "-")
|
||||
link = app.get("repo_url", "#")
|
||||
tags = ""
|
||||
attribute_tags = ""
|
||||
property_tags = ""
|
||||
"""
|
||||
if app.get("tags"):
|
||||
tags += " " + " ".join(app["tags"])
|
||||
"""
|
||||
if app.get("tags"):
|
||||
tags = " " + " ".join(tag_map.get(tag, tag) for tag in app.get("tags", []))
|
||||
# attribute_tags = " " + " ".join(attribute_map.get(tag, tag) for tag in app.get("tags", []))
|
||||
attribute_tags = " " + " ".join(attribute_map[tag] for tag in app["tags"] if tag in attribute_map)
|
||||
property_tags = " ".join(f"`{property_map[tag]}`" for tag in app["tags"] if tag in property_map)
|
||||
|
||||
# app_platforms = " ".join(f"`{p}`" for p in app.get("platforms", []))
|
||||
app_platforms = " ".join(f"`{platform_map.get(p, p)}`" for p in app.get("platforms", []))
|
||||
@@ -131,7 +132,7 @@ def generate_contents(platform="all"):
|
||||
stars_formatted = f"**{format_stars(stars)}**" if stars is not None else ""
|
||||
# repo_path = extract_repo_path(link)
|
||||
# stars_badge = f"" if repo_path else ""
|
||||
md_output += f"| [{name}]({link}){tags} | {description} | {app_platforms} | {stars_formatted} |\n"
|
||||
md_output += f"| [{name}]({link}){attribute_tags}{property_tags} | {description} | {app_platforms} | {stars_formatted} |\n"
|
||||
md_output += "\n"
|
||||
return md_output
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import json
|
||||
|
||||
"""
|
||||
|
||||
# Load the JSON data from file
|
||||
with open("source/data/applications.json", "r", encoding="utf-8") as file:
|
||||
data = json.load(file)
|
||||
@@ -14,7 +16,7 @@ with open("source/data/applications.json", "w", encoding="utf-8") as file:
|
||||
json.dump(data, file, indent=4)
|
||||
|
||||
print("All platform entries have been converted to lowercase.")
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
# Load the JSON file
|
||||
@@ -30,4 +32,31 @@ with open("source/data/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:
|
||||
data = json.load(f)
|
||||
|
||||
# Platforms to check for
|
||||
move_to_tags = {"cli", "cli-plus", "tui", "pip"}
|
||||
|
||||
for app in data.get("applications", []):
|
||||
platforms = app.get("platforms", [])
|
||||
tags = set(app.get("tags", []))
|
||||
|
||||
# Move matching items to tags
|
||||
new_platforms = []
|
||||
for p in platforms:
|
||||
if p in move_to_tags:
|
||||
tags.add(p)
|
||||
else:
|
||||
new_platforms.append(p)
|
||||
|
||||
# Update the application
|
||||
app["platforms"] = new_platforms
|
||||
app["tags"] = sorted(tags)
|
||||
|
||||
# Save the updated file
|
||||
with open("source/data/applications.json", "w", encoding="utf-8") as f:
|
||||
json.dump(data, f, indent=4)
|
||||
|
||||
Reference in New Issue
Block a user