完善 脚手架UI

This commit is contained in:
yinsx
2025-12-20 15:26:49 +08:00
parent ad60f8c3ec
commit 7a6a55b535
7 changed files with 313 additions and 194 deletions

View File

@ -1,7 +1,7 @@
import color from "picocolors";
import { initKeypress, onKey, stopKeypress } from "../keyboard.js";
import { createStepUI } from "../utils/stepui.js";
import { frontendSteps } from "./config.js";
import { frameworkOptions, generateSteps } from "./config.js";
function clearScreen() {
process.stdout.write('\x1Bc');
@ -103,24 +103,24 @@ export async function gridSelect(items, title) {
});
}
// 创建组件配置UI
export function createComponentUI(frameworkName) {
// 创建框架+组件配置UI
export function createScaffoldUI(projectType) {
return createStepUI({
title: `${frameworkName} - 组件配置`,
getSteps: () => frontendSteps
title: `${projectType} - 项目配置`,
getSteps: () => generateSteps(projectType, null),
onStepChange: (framework) => generateSteps(projectType, framework)
});
}
// 解析配置结果
export function formatResults(results) {
const stepNames = frontendSteps.map(s => s.name);
export function formatResults(steps, results) {
const summary = [];
results.forEach((val, i) => {
if (Array.isArray(val) && val.length > 0) {
summary.push(`${stepNames[i]}: ${val.join(", ")}`);
summary.push(`${steps[i].name}: ${val.join(", ")}`);
} else if (val && val !== "none") {
summary.push(`${stepNames[i]}: ${val}`);
summary.push(`${steps[i].name}: ${val}`);
}
});
@ -139,14 +139,3 @@ export async function waitKey(message = "按任意键返回") {
});
});
}
// 显示占位信息
export function showPlaceholder(framework) {
clearScreen();
console.log("");
console.log(color.bgGreen(color.black(" 配置完成 ")));
console.log("");
console.log(color.cyan("框架: ") + framework.name);
console.log("");
console.log(color.yellow("功能开发中,敬请期待..."));
}