From fe8472f83d22d9a6d15d7f7e03758508679c033e Mon Sep 17 00:00:00 2001 From: Avaray <1459553+Avaray@users.noreply.github.com> Date: Mon, 23 Dec 2024 16:22:22 +0100 Subject: [PATCH] Update readme.ts --- readme.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/readme.ts b/readme.ts index c6b3a35..c9ab1cd 100644 --- a/readme.ts +++ b/readme.ts @@ -1,8 +1,18 @@ import { readFile, saveFile } from "./utils.ts"; +import process from "node:process"; +import { ratings, readFile, saveFile } from "./utils.ts"; import { services } from "./data/services.ts"; import { uis } from "./data/uis.ts"; +import { type UI, uis } from "./data/uis.ts"; import { type Checkpoint, checkpoints } from "./data/checkpoints.ts"; import t from "./data/templates.json" with { type: "json" }; +import templatesData from "./data/templates.json" with { type: "json" }; + +// Check if templatesData contains at least one key +if (!Object.keys(templatesData).length) { + console.error("No templates found"); + process.exit(1); +} export interface Template { // checkpoint ID @@ -18,7 +28,7 @@ export interface Template { }; } -const templates = t as Template; +const templates = templatesData as Template; let readme = await readFile("src/README.md"); @@ -28,8 +38,8 @@ const link = (service: string, templateId: string, uiId: string) => { return `${_ui?.name}`; }; -const sdxlTemplates = checkpoints.filter((ckpt) => ckpt.base === "sdxl").map((ckpt) => ckpt.id); -const pdxlTemplates = checkpoints.filter((ckpt) => ckpt.base === "pdxl").map((ckpt) => ckpt.id); +// const sdxlTemplates = checkpoints.filter((ckpt) => ckpt.base === "sdxl").map((ckpt) => ckpt.id); +// const pdxlTemplates = checkpoints.filter((ckpt) => ckpt.base === "pdxl").map((ckpt) => ckpt.id); console.log(sdxlTemplates); console.log(pdxlTemplates);