1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 23:59:45 +02:00

Feature/shopping lists second try (#927)

* generate types

* use generated types

* ui updates

* init button link for common styles

* add links

* setup label views

* add delete confirmation

* reset when not saved

* link label to foods and auto set when adding to shopping list

* generate types

* use inheritence to manage exception handling

* fix schema generation and add test for open_api generation

* add header to api docs

* move list consilidation to service

* split list and list items controller

* shopping list/list item tests - PARTIAL

* enable recipe add/remove in shopping lists

* generate types

* linting

* init global utility components

* update types and add list item api

* fix import cycle and database error

* add container and border classes

* new recipe list component

* fix tests

* breakout item editor

* refactor item editor

* update bulk actions

* update input / color contrast

* type generation

* refactor controller dependencies

* include food/unit editor

* remove console.logs

* fix and update type generation

* fix incorrect type for column

* fix postgres error

* fix delete by variable

* auto remove refs

* fix typo
This commit is contained in:
Hayden 2022-01-16 15:24:24 -09:00 committed by GitHub
parent f794208862
commit 92cf97e401
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 2556 additions and 685 deletions

View file

@ -2,6 +2,7 @@ from pathlib import Path
from jinja2 import Template
from pydantic2ts import generate_typescript_defs
from rich import print
# ============================================================
# Global Compoenents Generator
@ -73,22 +74,44 @@ def generate_typescript_types() -> None:
schema_path = PROJECT_DIR / "mealie" / "schema"
types_dir = PROJECT_DIR / "frontend" / "types" / "api-types"
ignore_dirs = ["__pycache__", "static"]
skipped_files: list[Path] = []
skipped_dirs: list[Path] = []
failed_modules: list[Path] = []
for module in schema_path.iterdir():
if module.is_dir() and module.stem in ignore_dirs:
skipped_dirs.append(module)
continue
if not module.is_dir() or not module.joinpath("__init__.py").is_file():
skipped_files.append(module)
continue
ts_out_name = module.name.replace("_", "-") + ".ts"
out_path = types_dir.joinpath(ts_out_name)
print(module) # noqa
try:
path_as_module = path_to_module(module)
generate_typescript_defs(path_as_module, str(out_path), exclude=("CamelModel"))
except Exception as e:
print(f"Failed to generate {module}") # noqa
failed_modules.append(module)
print("\nModule Errors:", module, "-----------------")
print(e) # noqa
print("Finished Module Errors:", module, "-----------------\n")
print("\n📁 Skipped Directories:") # noqa
for skipped_dir in skipped_dirs:
print(" 📁", skipped_dir.name) # noqa
print("📄 Skipped Files:") # noqa
for f in skipped_files:
print(" 📄", f.name) # noqa
print("❌ Failed Modules:") # noqa
for f in failed_modules:
print("", f.name) # noqa
if __name__ == "__main__":