mirror of
https://github.com/rjNemo/vf-site
synced 2026-06-06 01:16:38 +00:00
handle missing config file
This commit is contained in:
parent
6974c67aee
commit
f8bd649cf7
3 changed files with 10 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"name": "VillaFleurie",
|
||||
"templates": [
|
||||
"index.html",
|
||||
"t2-corail.html",
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ from typing import TypedDict
|
|||
|
||||
|
||||
class Config(TypedDict):
|
||||
name: str
|
||||
templates: list[str]
|
||||
outDir: str
|
||||
|
||||
|
|
|
|||
|
|
@ -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():
|
||||
try:
|
||||
config = load()
|
||||
logger.info("🏁 Start building site")
|
||||
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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue