feat(generator-runner): read index.html in readDirectory()

🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
木炎
2026-04-17 10:16:17 +08:00
parent 517ac6bf39
commit 614e9a3a45

View File

@@ -29,12 +29,11 @@ function runGenerator(params, sseWriter, projectRoot) {
args.push("--target-url", targetUrl);
}
args.push(
"--output-root",
normalize(outputRoot),
"--lessons",
normalize(lessons)
);
args.push("--output-root", normalize(outputRoot));
if (lessons) {
args.push("--lessons", normalize(lessons));
}
return new Promise((resolve, reject) => {
sseWriter.write(
@@ -170,6 +169,12 @@ function readDirectory(sourceDir) {
result["SKILL.md"] = fs.readFileSync(skillMdPath, "utf-8");
}
// Read index.html
const indexHtmlPath = p.join(sourceDir, "index.html");
if (fs.existsSync(indexHtmlPath)) {
result.indexHtml = fs.readFileSync(indexHtmlPath, "utf-8");
}
const scripts = {};
for (const entry of entries) {
if (entry.isFile() && entry.name.endsWith(".js")) {