Files
Frost/scripts/check-example.mjs
T

27 lines
975 B
JavaScript

import { readFile } from "node:fs/promises";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
const root = fileURLToPath(new URL("..", import.meta.url));
const html = await readFile(resolve(root, "examples/index.html"), "utf8");
const required = [
"frost-md:grid-cols-2",
"frost-hover:shadow",
"frost-navbar",
"frost-breadcrumbs",
"frost-tabs",
"frost-accordion",
"frost-table",
"frost-spinner",
"#theme-toggle",
"#menu-trigger",
];
const errors = required.filter((value) => !html.includes(value)).map((value) => `examples/index.html: missing demo marker ${value}`);
if (!html.includes("aria-selected") || !html.includes("aria-expanded")) errors.push("examples/index.html: interactive ARIA state markers are missing");
if (errors.length) {
console.error(errors.join("\n"));
process.exitCode = 1;
} else {
console.log(`Checked ${required.length} utility, component, and interaction markers in examples/index.html.`);
}