zant-admin 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +1 -1
- package/bin/prompts.js +17 -53
- package/package.json +1 -1
package/bin/cli.js
CHANGED
package/bin/prompts.js
CHANGED
|
@@ -12,7 +12,7 @@ export function createPromptInterface() {
|
|
|
12
12
|
input: process.stdin,
|
|
13
13
|
output: process.stdout
|
|
14
14
|
});
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
return rl;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -37,33 +37,32 @@ export function closePrompt(rl) {
|
|
|
37
37
|
*/
|
|
38
38
|
export async function collectProjectConfig(projectName) {
|
|
39
39
|
const rl = createPromptInterface();
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
console.log('\n🎯 项目配置向导');
|
|
42
42
|
console.log('='.repeat(50));
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
const config = {
|
|
45
45
|
projectName,
|
|
46
46
|
description: '',
|
|
47
47
|
author: '',
|
|
48
|
-
template: 'default'
|
|
49
|
-
features: []
|
|
48
|
+
template: 'default'
|
|
50
49
|
};
|
|
51
|
-
|
|
50
|
+
|
|
52
51
|
try {
|
|
53
52
|
// 询问项目描述
|
|
54
53
|
config.description = await question(rl, '📝 请输入项目描述: ') || '基于 Vue 3 + Vite + Ant Design Vue 的前端管理系统';
|
|
55
|
-
|
|
54
|
+
|
|
56
55
|
// 询问作者名称
|
|
57
56
|
config.author = await question(rl, '👤 请输入作者名称 (可选): ');
|
|
58
|
-
|
|
57
|
+
|
|
59
58
|
// 选择模板类型
|
|
60
59
|
console.log('\n📋 请选择项目模板:');
|
|
61
60
|
console.log('1. 默认模板 (推荐) - 包含完整的管理系统功能');
|
|
62
61
|
console.log('2. 基础模板 - 仅包含核心功能');
|
|
63
62
|
console.log('3. 完整模板 - 包含所有示例和高级功能');
|
|
64
|
-
|
|
63
|
+
|
|
65
64
|
const templateChoice = await question(rl, '请选择 (1-3, 默认 1): ');
|
|
66
|
-
|
|
65
|
+
|
|
67
66
|
switch (templateChoice) {
|
|
68
67
|
case '2':
|
|
69
68
|
config.template = 'basic';
|
|
@@ -74,58 +73,23 @@ export async function collectProjectConfig(projectName) {
|
|
|
74
73
|
default:
|
|
75
74
|
config.template = 'default';
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
// 选择功能特性
|
|
79
|
-
console.log('\n✨ 请选择要包含的功能特性 (可多选):');
|
|
80
|
-
console.log('1. 用户管理模块');
|
|
81
|
-
console.log('2. 权限管理模块');
|
|
82
|
-
console.log('3. 数据可视化图表');
|
|
83
|
-
console.log('4. 文件上传功能');
|
|
84
|
-
console.log('5. 国际化支持');
|
|
85
|
-
|
|
86
|
-
const featureChoices = await question(rl, '请输入功能编号 (用逗号分隔, 如 1,3,5): ');
|
|
87
|
-
|
|
88
|
-
if (featureChoices) {
|
|
89
|
-
const choices = featureChoices.split(',').map(c => c.trim());
|
|
90
|
-
|
|
91
|
-
choices.forEach(choice => {
|
|
92
|
-
switch (choice) {
|
|
93
|
-
case '1':
|
|
94
|
-
config.features.push('user-management');
|
|
95
|
-
break;
|
|
96
|
-
case '2':
|
|
97
|
-
config.features.push('permission-management');
|
|
98
|
-
break;
|
|
99
|
-
case '3':
|
|
100
|
-
config.features.push('data-visualization');
|
|
101
|
-
break;
|
|
102
|
-
case '4':
|
|
103
|
-
config.features.push('file-upload');
|
|
104
|
-
break;
|
|
105
|
-
case '5':
|
|
106
|
-
config.features.push('i18n-support');
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
76
|
+
|
|
112
77
|
// 确认配置
|
|
113
78
|
console.log('\n📊 配置摘要:');
|
|
114
79
|
console.log(` 项目名称: ${config.projectName}`);
|
|
115
80
|
console.log(` 项目描述: ${config.description}`);
|
|
116
81
|
console.log(` 作者名称: ${config.author || '未指定'}`);
|
|
117
82
|
console.log(` 项目模板: ${getTemplateName(config.template)}`);
|
|
118
|
-
|
|
119
|
-
|
|
83
|
+
|
|
120
84
|
const confirm = await question(rl, '\n✅ 确认创建项目? (y/N): ');
|
|
121
|
-
|
|
85
|
+
|
|
122
86
|
if (confirm.toLowerCase() !== 'y' && confirm.toLowerCase() !== 'yes') {
|
|
123
87
|
console.log('❌ 项目创建已取消');
|
|
124
88
|
process.exit(0);
|
|
125
89
|
}
|
|
126
|
-
|
|
90
|
+
|
|
127
91
|
return config;
|
|
128
|
-
|
|
92
|
+
|
|
129
93
|
} finally {
|
|
130
94
|
closePrompt(rl);
|
|
131
95
|
}
|
|
@@ -140,7 +104,7 @@ function getTemplateName(template) {
|
|
|
140
104
|
'basic': '基础模板',
|
|
141
105
|
'full': '完整模板'
|
|
142
106
|
};
|
|
143
|
-
|
|
107
|
+
|
|
144
108
|
return templates[template] || template;
|
|
145
109
|
}
|
|
146
110
|
|
|
@@ -149,11 +113,11 @@ function getTemplateName(template) {
|
|
|
149
113
|
*/
|
|
150
114
|
export async function askSkipInstall() {
|
|
151
115
|
const rl = createPromptInterface();
|
|
152
|
-
|
|
116
|
+
|
|
153
117
|
try {
|
|
154
118
|
const answer = await question(rl, '\n📦 是否跳过依赖安装? (y/N): ');
|
|
155
119
|
return answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes';
|
|
156
120
|
} finally {
|
|
157
121
|
closePrompt(rl);
|
|
158
122
|
}
|
|
159
|
-
}
|
|
123
|
+
}
|