1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 10:48:44 +00:00

Add first auto doc test

This commit is contained in:
Wendelin
2025-05-05 16:43:35 +02:00
parent 736afe2530
commit dba6841a93
4 changed files with 1298 additions and 37 deletions

View File

@@ -3,6 +3,9 @@ import { glob } from "glob";
import gulp from "gulp";
import yaml from "js-yaml";
import { marked } from "marked";
import ts from "typescript";
import { create } from "@custom-elements-manifest/analyzer";
import { litPlugin } from "@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/lit.js";
import path from "path";
import paths from "../paths.cjs";
import "./clean.js";
@@ -13,6 +16,30 @@ import "./service-worker.js";
import "./translations.js";
import "./rspack.js";
gulp.task("generate-component-docs", async function generateComponentDocs() {
const filePaths = ["src/components/ha-alert.ts"];
const modules = await Promise.all(
filePaths.map(async (file) => {
const filePath = path.resolve(file);
return ts.createSourceFile(
filePath,
await fs.promises.readFile(filePath, "utf-8"),
ts.ScriptTarget.ES2015,
true
);
})
);
const manifest = create({
modules,
plugins: [...litPlugin()],
context: { dev: false },
});
console.log(manifest);
});
gulp.task("gather-gallery-pages", async function gatherPages() {
const pageDir = path.resolve(paths.gallery_dir, "src/pages");
const files = await glob(path.resolve(pageDir, "**/*"));