diff --git a/config.json b/config.json index 4b57783..7a52d43 100644 --- a/config.json +++ b/config.json @@ -1,4 +1,5 @@ { + "name": "VillaFleurie", "templates": [ "index.html", "t2-corail.html", diff --git a/lib/config.py b/lib/config.py index a2d6a5a..908f0b1 100644 --- a/lib/config.py +++ b/lib/config.py @@ -3,6 +3,7 @@ from typing import TypedDict class Config(TypedDict): + name: str templates: list[str] outDir: str diff --git a/lib/main.py b/lib/main.py index d571b9f..067ee0f 100644 --- a/lib/main.py +++ b/lib/main.py @@ -1,3 +1,4 @@ +import sys from os import path from loguru import logger @@ -7,8 +8,13 @@ from lib.engine import render def main(): - config = load() - logger.info("๐Ÿ Start building site") + try: + config = load() + except FileNotFoundError: + logger.error("The configuration file 'config.json' was not found. Please verify it exists at the root level") + sys.exit() + + logger.info(f"๐Ÿ Start building {config['name']}") for template in config["templates"]: logger.info(f"๐Ÿ“ƒRender '{template}'") with open(path.join(config["outDir"], template), "w") as f: