@agile-team/robot-cli 1.1.4 → 1.1.6
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/lib/create.js +72 -26
- package/package.json +1 -1
package/lib/create.js
CHANGED
|
@@ -144,27 +144,38 @@ async function selectTemplateMethod() {
|
|
|
144
144
|
message: "模板选择方式:",
|
|
145
145
|
choices: [
|
|
146
146
|
{
|
|
147
|
-
name: `${chalk.cyan('●')} ${chalk.bold('推荐模板')} ${chalk.dim('(常用模板快速选择)')}
|
|
148
|
-
${chalk.dim('- 基于团队使用频率推荐的热门模板')}`,
|
|
147
|
+
name: `${chalk.cyan('●')} ${chalk.bold('推荐模板')} ${chalk.dim('(常用模板快速选择) - 基于团队使用频率推荐的热门模板')}`,
|
|
149
148
|
value: "recommended"
|
|
150
149
|
},
|
|
150
|
+
{
|
|
151
|
+
name: chalk.dim("─".repeat(70)),
|
|
152
|
+
value: "sep1",
|
|
153
|
+
disabled: true
|
|
154
|
+
},
|
|
151
155
|
{
|
|
152
|
-
name: `${chalk.cyan('●')} ${chalk.bold('分类模板')} ${chalk.dim('(按项目类型分类选择)')}
|
|
153
|
-
${chalk.dim('- 前端、后端、移动端、桌面端分类浏览')}`,
|
|
156
|
+
name: `${chalk.cyan('●')} ${chalk.bold('分类模板')} ${chalk.dim('(按项目类型分类选择) - 前端、后端、移动端、桌面端分类浏览')}`,
|
|
154
157
|
value: "category"
|
|
155
158
|
},
|
|
159
|
+
{
|
|
160
|
+
name: chalk.dim("─".repeat(70)),
|
|
161
|
+
value: "sep2",
|
|
162
|
+
disabled: true
|
|
163
|
+
},
|
|
156
164
|
{
|
|
157
|
-
name: `${chalk.cyan('●')} ${chalk.bold('搜索模板')} ${chalk.dim('(关键词搜索)')}
|
|
158
|
-
${chalk.dim('- 通过技术栈、功能特性等关键词快速查找')}`,
|
|
165
|
+
name: `${chalk.cyan('●')} ${chalk.bold('搜索模板')} ${chalk.dim('(关键词搜索) - 通过技术栈、功能特性等关键词快速查找')}`,
|
|
159
166
|
value: "search"
|
|
160
167
|
},
|
|
168
|
+
{
|
|
169
|
+
name: chalk.dim("─".repeat(70)),
|
|
170
|
+
value: "sep3",
|
|
171
|
+
disabled: true
|
|
172
|
+
},
|
|
161
173
|
{
|
|
162
|
-
name: `${chalk.cyan('●')} ${chalk.bold('全部模板')} ${chalk.dim('(查看所有可用模板)')}
|
|
163
|
-
${chalk.dim('- 按分类展示所有可用的项目模板')}`,
|
|
174
|
+
name: `${chalk.cyan('●')} ${chalk.bold('全部模板')} ${chalk.dim('(查看所有可用模板) - 按分类展示所有可用的项目模板')}`,
|
|
164
175
|
value: "all"
|
|
165
176
|
},
|
|
166
177
|
],
|
|
167
|
-
pageSize:
|
|
178
|
+
pageSize: 10
|
|
168
179
|
},
|
|
169
180
|
]);
|
|
170
181
|
|
|
@@ -202,7 +213,7 @@ async function selectFromRecommended() {
|
|
|
202
213
|
const choices = Object.entries(recommended).map(([key, template]) => {
|
|
203
214
|
// 构建特性标签
|
|
204
215
|
const featureTags = template.features.slice(0, 3).map(f =>
|
|
205
|
-
chalk.
|
|
216
|
+
chalk.dim(`[${f}]`)
|
|
206
217
|
).join(' ');
|
|
207
218
|
|
|
208
219
|
// 版本标签 - 只保留方括号内的版本
|
|
@@ -211,16 +222,27 @@ async function selectFromRecommended() {
|
|
|
211
222
|
chalk.yellow('[精简版]');
|
|
212
223
|
|
|
213
224
|
return {
|
|
214
|
-
name: `${chalk.bold.white(template.name.replace(/\s*(完整版|精简版)\s*$/, ''))} ${versionTag}
|
|
215
|
-
${chalk.dim(template.
|
|
216
|
-
${featureTags}${template.features.length > 3 ? chalk.dim(` +${template.features.length - 3}more`) : ''}
|
|
217
|
-
${chalk.dim('━'.repeat(60))}`,
|
|
225
|
+
name: `${chalk.bold.white(template.name.replace(/\s*(完整版|精简版)\s*$/, ''))} ${versionTag} - ${chalk.dim(template.description)}
|
|
226
|
+
${chalk.dim(featureTags)}${template.features.length > 3 ? chalk.dim(` +${template.features.length - 3}more`) : ''}`,
|
|
218
227
|
value: { key, ...template },
|
|
219
228
|
short: template.name,
|
|
220
229
|
};
|
|
221
230
|
});
|
|
222
231
|
|
|
223
|
-
|
|
232
|
+
// 为每个推荐模板添加分隔符
|
|
233
|
+
const choicesWithSeparators = [];
|
|
234
|
+
choices.forEach((choice, index) => {
|
|
235
|
+
choicesWithSeparators.push(choice);
|
|
236
|
+
if (index < choices.length - 1) {
|
|
237
|
+
choicesWithSeparators.push({
|
|
238
|
+
name: chalk.dim("━".repeat(60)),
|
|
239
|
+
value: `sep_${index}`,
|
|
240
|
+
disabled: true
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
choicesWithSeparators.push({
|
|
224
246
|
name: chalk.dim("⬅️ 返回选择其他方式"),
|
|
225
247
|
value: "back",
|
|
226
248
|
});
|
|
@@ -230,8 +252,8 @@ async function selectFromRecommended() {
|
|
|
230
252
|
type: "list",
|
|
231
253
|
name: "selectedTemplate",
|
|
232
254
|
message: "选择推荐模板:",
|
|
233
|
-
choices,
|
|
234
|
-
pageSize:
|
|
255
|
+
choices: choicesWithSeparators,
|
|
256
|
+
pageSize: 15,
|
|
235
257
|
loop: false
|
|
236
258
|
},
|
|
237
259
|
]);
|
|
@@ -579,12 +601,18 @@ async function selectFromAll() {
|
|
|
579
601
|
chalk.green('[完整版]') : chalk.yellow('[精简版]');
|
|
580
602
|
|
|
581
603
|
categorizedChoices.push({
|
|
582
|
-
name: ` ● ${chalk.bold(template.name.replace(/\s*(完整版|精简版)\s*$/, ''))} ${versionTag}
|
|
583
|
-
${chalk.dim(template.description)}
|
|
604
|
+
name: ` ● ${chalk.bold(template.name.replace(/\s*(完整版|精简版)\s*$/, ''))} ${versionTag} - ${chalk.dim(template.description)}
|
|
584
605
|
${chalk.dim(`技术栈: ${techStack} • 命令: robot create my-app -t ${key}`)}`,
|
|
585
606
|
value: { key, ...template },
|
|
586
607
|
short: template.name
|
|
587
608
|
});
|
|
609
|
+
|
|
610
|
+
// 添加分隔符
|
|
611
|
+
categorizedChoices.push({
|
|
612
|
+
name: chalk.dim(" " + "─".repeat(66)),
|
|
613
|
+
value: `sep_${key}`,
|
|
614
|
+
disabled: true
|
|
615
|
+
});
|
|
588
616
|
});
|
|
589
617
|
|
|
590
618
|
// 移动端模板
|
|
@@ -606,12 +634,18 @@ async function selectFromAll() {
|
|
|
606
634
|
chalk.green('[完整版]') : chalk.yellow('[精简版]');
|
|
607
635
|
|
|
608
636
|
categorizedChoices.push({
|
|
609
|
-
name: ` ● ${chalk.bold(template.name.replace(/\s*(完整版|精简版)\s*$/, ''))} ${versionTag}
|
|
610
|
-
${chalk.dim(template.description)}
|
|
637
|
+
name: ` ● ${chalk.bold(template.name.replace(/\s*(完整版|精简版)\s*$/, ''))} ${versionTag} - ${chalk.dim(template.description)}
|
|
611
638
|
${chalk.dim(`跨平台: 小程序/H5/App • 命令: robot create my-app -t ${key}`)}`,
|
|
612
639
|
value: { key, ...template },
|
|
613
640
|
short: template.name
|
|
614
641
|
});
|
|
642
|
+
|
|
643
|
+
// 添加分隔符
|
|
644
|
+
categorizedChoices.push({
|
|
645
|
+
name: chalk.dim(" " + "─".repeat(66)),
|
|
646
|
+
value: `sep_${key}`,
|
|
647
|
+
disabled: true
|
|
648
|
+
});
|
|
615
649
|
});
|
|
616
650
|
|
|
617
651
|
// 后端模板
|
|
@@ -634,12 +668,18 @@ async function selectFromAll() {
|
|
|
634
668
|
chalk.green('[完整版]') : chalk.yellow('[精简版]');
|
|
635
669
|
|
|
636
670
|
categorizedChoices.push({
|
|
637
|
-
name: ` ● ${chalk.bold(template.name.replace(/\s*(完整版|精简版)\s*$/, ''))} ${versionTag}
|
|
638
|
-
${chalk.dim(template.description)}
|
|
671
|
+
name: ` ● ${chalk.bold(template.name.replace(/\s*(完整版|精简版)\s*$/, ''))} ${versionTag} - ${chalk.dim(template.description)}
|
|
639
672
|
${chalk.dim(`框架: ${framework} • 命令: robot create my-app -t ${key}`)}`,
|
|
640
673
|
value: { key, ...template },
|
|
641
674
|
short: template.name
|
|
642
675
|
});
|
|
676
|
+
|
|
677
|
+
// 添加分隔符
|
|
678
|
+
categorizedChoices.push({
|
|
679
|
+
name: chalk.dim(" " + "─".repeat(66)),
|
|
680
|
+
value: `sep_${key}`,
|
|
681
|
+
disabled: true
|
|
682
|
+
});
|
|
643
683
|
});
|
|
644
684
|
|
|
645
685
|
// 桌面端模板
|
|
@@ -662,12 +702,18 @@ async function selectFromAll() {
|
|
|
662
702
|
chalk.green('[完整版]') : chalk.yellow('[精简版]');
|
|
663
703
|
|
|
664
704
|
categorizedChoices.push({
|
|
665
|
-
name: ` ● ${chalk.bold(template.name.replace(/\s*(完整版|精简版)\s*$/, ''))} ${versionTag}
|
|
666
|
-
${chalk.dim(template.description)}
|
|
705
|
+
name: ` ● ${chalk.bold(template.name.replace(/\s*(完整版|精简版)\s*$/, ''))} ${versionTag} - ${chalk.dim(template.description)}
|
|
667
706
|
${chalk.dim(`框架: ${framework} • 命令: robot create my-app -t ${key}`)}`,
|
|
668
707
|
value: { key, ...template },
|
|
669
708
|
short: template.name
|
|
670
709
|
});
|
|
710
|
+
|
|
711
|
+
// 添加分隔符
|
|
712
|
+
categorizedChoices.push({
|
|
713
|
+
name: chalk.dim(" " + "─".repeat(66)),
|
|
714
|
+
value: `sep_${key}`,
|
|
715
|
+
disabled: true
|
|
716
|
+
});
|
|
671
717
|
});
|
|
672
718
|
|
|
673
719
|
// 添加返回选项
|
|
@@ -689,7 +735,7 @@ async function selectFromAll() {
|
|
|
689
735
|
name: "selectedTemplate",
|
|
690
736
|
message: "选择模板:",
|
|
691
737
|
choices: categorizedChoices,
|
|
692
|
-
pageSize:
|
|
738
|
+
pageSize: 25,
|
|
693
739
|
loop: false
|
|
694
740
|
},
|
|
695
741
|
]);
|