refactor: move app packages under apps
This commit is contained in:
@@ -12,10 +12,11 @@ https://gitea.va.reichard.io/evan/xteink-apps/raw/branch/main/catalog.txt
|
|||||||
|
|
||||||
```text
|
```text
|
||||||
catalog.txt
|
catalog.txt
|
||||||
<AppId>/
|
apps/
|
||||||
manifest.txt
|
<AppId>/
|
||||||
main.lua
|
manifest.txt
|
||||||
...
|
main.lua
|
||||||
|
...
|
||||||
scripts/update-manifests.py
|
scripts/update-manifests.py
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ XTEINK-CATALOG|1
|
|||||||
<AppId>|<description>|<manifest path>|<manifest bytes>|<manifest SHA-256>
|
<AppId>|<description>|<manifest path>|<manifest bytes>|<manifest SHA-256>
|
||||||
```
|
```
|
||||||
|
|
||||||
Each generated `manifest.txt` contains every installable file in that app:
|
Each generated `apps/<AppId>/manifest.txt` contains every installable file in that app:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
XTEINK-MANIFEST|1
|
XTEINK-MANIFEST|1
|
||||||
@@ -37,7 +38,7 @@ App IDs and file paths cannot contain `|`. App IDs use only letters, numbers, `_
|
|||||||
|
|
||||||
## Adding or changing an app
|
## Adding or changing an app
|
||||||
|
|
||||||
1. Add or edit an app directory containing `main.lua`.
|
1. Add or edit an `apps/<AppId>` directory containing `main.lua`.
|
||||||
2. Regenerate metadata:
|
2. Regenerate metadata:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
XTEINK-CATALOG|1
|
XTEINK-CATALOG|1
|
||||||
HomeAssistant|Home Assistant status cards|HomeAssistant/manifest.txt|177|27aa1f0edc78a5aeded413caf0508788fa597ee8f76a5b8515ec0c40c955d5be
|
HomeAssistant|Home Assistant status cards|apps/HomeAssistant/manifest.txt|177|27aa1f0edc78a5aeded413caf0508788fa597ee8f76a5b8515ec0c40c955d5be
|
||||||
Wordle|Guess the five-letter word in six tries|Wordle/manifest.txt|177|9977b49ffdbd67a254701b4fa38407fc9128a017673e3ce73560dea08a6a125e
|
Wordle|Guess the five-letter word in six tries|apps/Wordle/manifest.txt|177|9977b49ffdbd67a254701b4fa38407fc9128a017673e3ce73560dea08a6a125e
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import sys
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parent.parent
|
ROOT = Path(__file__).resolve().parent.parent
|
||||||
|
APPS_DIR = ROOT / "apps"
|
||||||
ID_PATTERN = re.compile(r"^[A-Za-z0-9_-]+$")
|
ID_PATTERN = re.compile(r"^[A-Za-z0-9_-]+$")
|
||||||
DESCRIPTION_PATTERN = re.compile(r"^--\s*DESCRIPTION:\s*(.+?)\s*$")
|
DESCRIPTION_PATTERN = re.compile(r"^--\s*DESCRIPTION:\s*(.+?)\s*$")
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ def build_manifest(app_dir: Path) -> bytes:
|
|||||||
|
|
||||||
|
|
||||||
def generated_files():
|
def generated_files():
|
||||||
apps = [path for path in ROOT.iterdir() if path.is_dir() and (path / "main.lua").is_file()]
|
apps = [path for path in APPS_DIR.iterdir() if path.is_dir() and (path / "main.lua").is_file()]
|
||||||
apps.sort(key=lambda path: path.name.casefold())
|
apps.sort(key=lambda path: path.name.casefold())
|
||||||
|
|
||||||
manifests = {}
|
manifests = {}
|
||||||
@@ -61,7 +62,7 @@ def generated_files():
|
|||||||
if not ID_PATTERN.fullmatch(app_id):
|
if not ID_PATTERN.fullmatch(app_id):
|
||||||
raise ValueError(f"invalid app id: {app_id}")
|
raise ValueError(f"invalid app id: {app_id}")
|
||||||
manifest = build_manifest(app_dir)
|
manifest = build_manifest(app_dir)
|
||||||
manifest_path = f"{app_id}/manifest.txt"
|
manifest_path = f"apps/{app_id}/manifest.txt"
|
||||||
manifests[ROOT / manifest_path] = manifest
|
manifests[ROOT / manifest_path] = manifest
|
||||||
catalog.append(
|
catalog.append(
|
||||||
f"{app_id}|{description(app_dir)}|{manifest_path}|{len(manifest)}|{sha256(manifest)}"
|
f"{app_id}|{description(app_dir)}|{manifest_path}|{len(manifest)}|{sha256(manifest)}"
|
||||||
|
|||||||
Reference in New Issue
Block a user