1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 15:49:42 +02:00

Feature/group based notifications (#918)

* fix group page

* setup group notification for backend

* update type generators

* script to auto-generate schema exports

* setup frontend CRUD interface

* remove old notifications UI

* drop old events api

* add test functionality

* update naming for fields

* add event dispatcher functionality

* bump to python 3.10

* bump python version

* purge old event code

* use-async apprise

* set mealie logo as image

* unify styles for buttons rows

* add links to banners
This commit is contained in:
Hayden 2022-01-09 21:04:24 -09:00 committed by GitHub
parent 50a341ed3f
commit 190773c5d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 1992 additions and 1229 deletions

View file

@ -1,58 +0,0 @@
from pathlib import Path
from jinja2 import Template
template = """// This Code is auto generated by gen_global_components.py
{% for name in global %} import {{ name }} from "@/components/global/{{ name }}.vue";
{% endfor %}
{% for name in layout %} import {{ name }} from "@/components/layout/{{ name }}.vue";
{% endfor %}
declare module "vue" {
export interface GlobalComponents {
// Global Components
{% for name in global %} {{ name }}: typeof {{ name }};
{% endfor %} // Layout Components
{% for name in layout %} {{ name }}: typeof {{ name }};
{% endfor %}
}
}
export {};
"""
project_dir = Path(__file__).parent.parent.parent
destination_file = project_dir / "frontend" / "types" / "components.d.ts"
component_paths = {
"global": project_dir / "frontend" / "components" / "global",
"layout": project_dir / "frontend" / "components" / "Layout",
}
def render_template(template: str, data: dict) -> None:
template = Template(template)
return template.render(**data)
def build_data(component_paths: dict) -> dict:
data = {}
for name, path in component_paths.items():
components = []
for component in path.glob("*.vue"):
components.append(component.stem)
data[name] = components
return data
def write_template(text: str) -> None:
destination_file.write_text(text)
if __name__ == "__main__":
data = build_data(component_paths)
text = render_template(template, build_data(component_paths))
write_template(text)

View file

@ -1,37 +0,0 @@
from pathlib import Path
from pydantic2ts import generate_typescript_defs
CWD = Path(__file__).parent
PROJECT_DIR = Path(__file__).parent.parent.parent
SCHEMA_PATH = PROJECT_DIR / "mealie" / "schema"
TYPES_DIR = CWD / "output" / "types" / "api-types"
def path_to_module(path: Path):
path: str = str(path)
path = path.removeprefix(str(PROJECT_DIR))
path = path.removeprefix("/")
path = path.replace("/", ".")
return path
for module in SCHEMA_PATH.iterdir():
if not module.is_dir() or not module.joinpath("__init__.py").is_file():
continue
ts_out_name = module.name.replace("_", "-") + ".ts"
out_path = TYPES_DIR.joinpath(ts_out_name)
print(module)
try:
path_as_module = path_to_module(module)
generate_typescript_defs(path_as_module, str(out_path), exclude=("CamelModel"))
except Exception:
pass