优化第一阶段
This commit is contained in:
42
lib/plugins/scaffold/index.js
Normal file
42
lib/plugins/scaffold/index.js
Normal file
@ -0,0 +1,42 @@
|
||||
import color from "picocolors";
|
||||
import { projectTypes } from "./config.js";
|
||||
import { gridSelect } from "../../grid.js";
|
||||
import { createScaffoldUI, formatResults, waitKey } from "./ui.js";
|
||||
|
||||
async function run() {
|
||||
while (true) {
|
||||
// 二级菜单 - 项目类型
|
||||
const typeResult = await gridSelect({
|
||||
items: projectTypes,
|
||||
title: "项目搭建器 - 选择类型",
|
||||
cols: Math.min(3, projectTypes.length),
|
||||
colWidth: 20,
|
||||
instructions: "←→ 选择 | Enter 确认 | Esc 返回",
|
||||
onCancel: "back",
|
||||
mapper: item => ({ action: "select", item }),
|
||||
showUpdateButton: false,
|
||||
});
|
||||
|
||||
if (typeResult === "back") return "back";
|
||||
|
||||
const projectType = typeResult.item.name;
|
||||
|
||||
// 三级页面 - 框架+组件配置(合并)
|
||||
const ui = createScaffoldUI(projectType);
|
||||
const result = await ui.runInteractive();
|
||||
|
||||
if (result) {
|
||||
const summary = formatResults(result.steps, result.results);
|
||||
ui.showSummary(summary);
|
||||
console.log(color.yellow("功能开发中,敬请期待..."));
|
||||
await waitKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
id: "scaffold",
|
||||
name: "项目搭建",
|
||||
desc: "快速创建项目模板",
|
||||
run,
|
||||
};
|
||||
Reference in New Issue
Block a user