优化卡死的问题

This commit is contained in:
yinsx
2025-12-20 14:13:59 +08:00
parent 3098796a08
commit ad60f8c3ec
7 changed files with 495 additions and 108 deletions

39
lib/scaffold/index.js Normal file
View File

@ -0,0 +1,39 @@
import color from "picocolors";
import { projectTypes, frameworks } from "./config.js";
import { gridSelect, createComponentUI, formatResults, waitKey, showPlaceholder } from "./ui.js";
export async function run() {
while (true) {
// 二级菜单 - 项目类型
const typeResult = await gridSelect(projectTypes, "项目脚手架 - 选择类型");
if (typeResult.action === "back") return "back";
const projectType = typeResult.item.name;
const frameworkList = frameworks[projectType];
while (true) {
// 三级菜单 - 框架选择
const frameworkResult = await gridSelect(frameworkList, `${projectType}项目 - 选择框架`);
if (frameworkResult.action === "back") break;
const framework = frameworkResult.item;
if (projectType === "前端" || projectType === "全栈") {
// 组件配置
const ui = createComponentUI(framework.name);
const result = await ui.runInteractive();
if (result) {
const summary = formatResults(result.results);
ui.showSummary(summary);
console.log(color.yellow("功能开发中,敬请期待..."));
await waitKey();
}
} else {
// 后端暂无组件配置
showPlaceholder(framework);
await waitKey();
}
}
}
}