@agile-team/robot-cli 3.0.4 → 3.0.5

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.
Files changed (2) hide show
  1. package/dist/index.js +54 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -54,7 +54,8 @@ var TEMPLATE_CATEGORIES = {
54
54
  description: "\u57FA\u7840\u67B6\u6784\u3001\u6838\u5FC3\u529F\u80FD\u3001\u5FEB\u901F\u542F\u52A8",
55
55
  repoUrl: "https://github.com/ChenyCHENYU/Robot_Admin_Base",
56
56
  features: ["Naive UI", "Vue Router", "Pinia", "\u57FA\u7840\u5E03\u5C40"],
57
- version: "base"
57
+ version: "base",
58
+ status: "coming-soon"
58
59
  }
59
60
  }
60
61
  },
@@ -108,14 +109,16 @@ var TEMPLATE_CATEGORIES = {
108
109
  description: "Ant Design + \u5B8C\u6574\u529F\u80FD\u6F14\u793A",
109
110
  repoUrl: "https://github.com/ChenyCHENYU/Robot_React",
110
111
  features: ["Ant Design", "React Router", "Redux Toolkit"],
111
- version: "full"
112
+ version: "full",
113
+ status: "coming-soon"
112
114
  },
113
115
  "robot-react-base": {
114
116
  name: "Robot React \u7CBE\u7B80\u7248",
115
117
  description: "\u57FA\u7840React + \u6838\u5FC3\u529F\u80FD",
116
118
  repoUrl: "https://github.com/ChenyCHENYU/Robot_React_Base",
117
119
  features: ["React", "React Router", "\u57FA\u7840\u7EC4\u4EF6"],
118
- version: "base"
120
+ version: "base",
121
+ status: "coming-soon"
119
122
  }
120
123
  }
121
124
  }
@@ -145,7 +148,8 @@ var TEMPLATE_CATEGORIES = {
145
148
  description: "\u57FA\u7840\u6846\u67B6 + \u6838\u5FC3\u529F\u80FD",
146
149
  repoUrl: "https://github.com/ChenyCHENYU/Robot_Uniapp_Base",
147
150
  features: ["\u57FA\u7840\u6846\u67B6", "\u8DEF\u7531\u914D\u7F6E"],
148
- version: "base"
151
+ version: "base",
152
+ status: "coming-soon"
149
153
  }
150
154
  }
151
155
  }
@@ -174,14 +178,16 @@ var TEMPLATE_CATEGORIES = {
174
178
  "Redis",
175
179
  "\u5FAE\u670D\u52A1"
176
180
  ],
177
- version: "full"
181
+ version: "full",
182
+ status: "coming-soon"
178
183
  },
179
184
  "robot-nest-base": {
180
185
  name: "Robot NestJS \u7CBE\u7B80\u7248",
181
186
  description: "\u57FA\u7840 NestJS + \u6838\u5FC3\u6A21\u5757",
182
187
  repoUrl: "https://github.com/ChenyCHENYU/Robot_Nest_Base",
183
188
  features: ["NestJS", "\u57FA\u7840\u8DEF\u7531", "\u9519\u8BEF\u5904\u7406"],
184
- version: "base"
189
+ version: "base",
190
+ status: "coming-soon"
185
191
  }
186
192
  }
187
193
  },
@@ -193,7 +199,8 @@ var TEMPLATE_CATEGORIES = {
193
199
  description: "NestJS + \u5FAE\u670D\u52A1\u67B6\u6784 + gRPC + \u670D\u52A1\u53D1\u73B0",
194
200
  repoUrl: "https://github.com/ChenyCHENYU/Robot_Nest_Micro",
195
201
  features: ["NestJS", "\u5FAE\u670D\u52A1", "gRPC", "Redis", "\u670D\u52A1\u53D1\u73B0"],
196
- version: "micro"
202
+ version: "micro",
203
+ status: "coming-soon"
197
204
  }
198
205
  }
199
206
  }
@@ -215,14 +222,16 @@ var TEMPLATE_CATEGORIES = {
215
222
  description: "Vue3 + Electron + \u81EA\u52A8\u66F4\u65B0 + \u539F\u751F\u80FD\u529B",
216
223
  repoUrl: "https://github.com/ChenyCHENYU/Robot_Electron",
217
224
  features: ["Vue3", "Electron", "\u81EA\u52A8\u66F4\u65B0", "\u539F\u751FAPI"],
218
- version: "full"
225
+ version: "full",
226
+ status: "coming-soon"
219
227
  },
220
228
  "robot-electron-base": {
221
229
  name: "Robot Electron \u7CBE\u7B80\u7248",
222
230
  description: "\u57FA\u7840Electron + Vue\u6846\u67B6",
223
231
  repoUrl: "https://github.com/ChenyCHENYU/Robot_Electron_Base",
224
232
  features: ["Vue3", "Electron", "\u57FA\u7840\u529F\u80FD"],
225
- version: "base"
233
+ version: "base",
234
+ status: "coming-soon"
226
235
  }
227
236
  }
228
237
  }
@@ -948,6 +957,9 @@ function formatBytes(bytes) {
948
957
 
949
958
  // src/create.ts
950
959
  var STRIP_VERSION_RE = /\s*(完整版|精简版|微服务版)\s*$/;
960
+ function filterAvailable(map) {
961
+ return Object.fromEntries(Object.entries(map).filter(([, t]) => t.status !== "coming-soon"));
962
+ }
951
963
  async function createProject(projectName, options = {}) {
952
964
  p.intro(chalk3.bgCyan.black(" Robot CLI - \u5F00\u59CB\u521B\u5EFA\u9879\u76EE "));
953
965
  let template;
@@ -1082,6 +1094,7 @@ async function selectFromRecommended() {
1082
1094
  p.log.info(chalk3.bold("\u63A8\u8350\u6A21\u677F") + chalk3.dim(" \u2014 \u57FA\u4E8E\u56E2\u961F\u4F7F\u7528\u9891\u7387\u548C\u9879\u76EE\u6210\u719F\u5EA6\u63A8\u8350"));
1083
1095
  const options = [];
1084
1096
  for (const [key, template] of Object.entries(recommended)) {
1097
+ if (template.status === "coming-soon") continue;
1085
1098
  const ver = VERSION_LABELS[template.version] || template.version;
1086
1099
  const tags = template.features.slice(0, 3).join(", ");
1087
1100
  options.push({
@@ -1151,7 +1164,15 @@ async function selectByCategory() {
1151
1164
  if (pk === "back") continue;
1152
1165
  patternKey = pk;
1153
1166
  }
1154
- const templates = getTemplatesByCategory(catKey, stackKey, patternKey);
1167
+ const allTemplates = getTemplatesByCategory(catKey, stackKey, patternKey);
1168
+ const templates = filterAvailable(allTemplates);
1169
+ const comingSoonCount = Object.keys(allTemplates).length - Object.keys(templates).length;
1170
+ if (Object.keys(templates).length === 0) {
1171
+ const names = Object.values(allTemplates).map((t2) => t2.name).join("\u3001");
1172
+ p.log.warn(`\u8BE5\u5206\u7C7B\u4E0B\u7684\u6A21\u677F\u6B63\u5728\u5EFA\u8BBE\u4E2D\uFF0C\u656C\u8BF7\u671F\u5F85 (${names})`);
1173
+ await new Promise((r) => setTimeout(r, 600));
1174
+ continue;
1175
+ }
1155
1176
  const tplOptions = Object.entries(templates).map(([key, t2]) => {
1156
1177
  const ver = VERSION_LABELS[t2.version] || t2.version;
1157
1178
  return {
@@ -1160,6 +1181,13 @@ async function selectByCategory() {
1160
1181
  hint: t2.description
1161
1182
  };
1162
1183
  });
1184
+ if (comingSoonCount > 0) {
1185
+ tplOptions.push({
1186
+ value: "__coming_soon__",
1187
+ label: chalk3.dim(`+ ${comingSoonCount} \u4E2A\u6A21\u677F\u5F00\u53D1\u4E2D...`),
1188
+ hint: "\u656C\u8BF7\u671F\u5F85"
1189
+ });
1190
+ }
1163
1191
  tplOptions.push({ value: "back", label: "<- \u8FD4\u56DE", hint: "" });
1164
1192
  const tplKey = await p.select({
1165
1193
  message: "\u8BF7\u9009\u62E9\u6A21\u677F\u7248\u672C:",
@@ -1167,6 +1195,11 @@ async function selectByCategory() {
1167
1195
  });
1168
1196
  if (p.isCancel(tplKey)) process.exit(0);
1169
1197
  if (tplKey === "back") continue;
1198
+ if (tplKey === "__coming_soon__") {
1199
+ p.log.warn("\u8BE5\u6A21\u677F\u6B63\u5728\u5F00\u53D1\u4E2D\uFF0C\u656C\u8BF7\u671F\u5F85\uFF01");
1200
+ await new Promise((r) => setTimeout(r, 600));
1201
+ continue;
1202
+ }
1170
1203
  const t = templates[tplKey];
1171
1204
  return { key: tplKey, ...t };
1172
1205
  }
@@ -1179,7 +1212,8 @@ async function selectBySearch() {
1179
1212
  });
1180
1213
  if (p.isCancel(keyword)) return await selectTemplateMethod();
1181
1214
  const results = searchTemplates(keyword);
1182
- if (Object.keys(results).length === 0) {
1215
+ const availableResults = filterAvailable(results);
1216
+ if (Object.keys(availableResults).length === 0) {
1183
1217
  p.log.warn(`\u6CA1\u6709\u627E\u5230\u5339\u914D\u7684\u6A21\u677F (\u5173\u952E\u8BCD: "${keyword}")`);
1184
1218
  const action = await p.select({
1185
1219
  message: "\u8BF7\u9009\u62E9\u4E0B\u4E00\u6B65\u64CD\u4F5C:",
@@ -1191,9 +1225,9 @@ async function selectBySearch() {
1191
1225
  if (p.isCancel(action) || action === "back") return await selectTemplateMethod();
1192
1226
  continue;
1193
1227
  }
1194
- p.log.info(`\u5173\u952E\u8BCD: "${keyword}" -- \u627E\u5230 ${Object.keys(results).length} \u4E2A\u5339\u914D\u6A21\u677F`);
1228
+ p.log.info(`\u5173\u952E\u8BCD: "${keyword}" -- \u627E\u5230 ${Object.keys(availableResults).length} \u4E2A\u5339\u914D\u6A21\u677F`);
1195
1229
  const options = [];
1196
- for (const [key, t2] of Object.entries(results)) {
1230
+ for (const [key, t2] of Object.entries(availableResults)) {
1197
1231
  const ver = VERSION_LABELS[t2.version] || t2.version;
1198
1232
  const info = t2.features.slice(0, 3).join(", ");
1199
1233
  options.push({
@@ -1213,18 +1247,22 @@ async function selectBySearch() {
1213
1247
  if (p.isCancel(selected)) process.exit(0);
1214
1248
  if (selected === "search_again") continue;
1215
1249
  if (selected === "back_to_mode") return await selectTemplateMethod();
1216
- const t = results[selected];
1250
+ const t = availableResults[selected];
1217
1251
  return { key: selected, ...t };
1218
1252
  }
1219
1253
  }
1220
1254
  async function selectFromAll() {
1221
1255
  const allTemplates = getAllTemplates();
1222
- p.log.info(chalk3.bold("\u6240\u6709\u53EF\u7528\u6A21\u677F") + chalk3.dim(` -- \u5171 ${Object.keys(allTemplates).length} \u4E2A\u6A21\u677F\u53EF\u9009`));
1256
+ const availableTemplates = filterAvailable(allTemplates);
1257
+ const comingSoonCount = Object.keys(allTemplates).length - Object.keys(availableTemplates).length;
1258
+ const countInfo = comingSoonCount > 0 ? chalk3.dim(` -- \u5171 ${Object.keys(availableTemplates).length} \u4E2A\u53EF\u7528\uFF0C${comingSoonCount} \u4E2A\u5F00\u53D1\u4E2D`) : chalk3.dim(` -- \u5171 ${Object.keys(availableTemplates).length} \u4E2A\u6A21\u677F\u53EF\u9009`);
1259
+ p.log.info(chalk3.bold("\u6240\u6709\u53EF\u7528\u6A21\u677F") + countInfo);
1223
1260
  const options = [];
1224
1261
  for (const [_catKey, category] of Object.entries(TEMPLATE_CATEGORIES)) {
1225
1262
  for (const [_sKey, stack] of Object.entries(category.stacks)) {
1226
1263
  for (const _pattern of Object.values(stack.patterns)) {
1227
1264
  for (const [key, t2] of Object.entries(_pattern.templates)) {
1265
+ if (t2.status === "coming-soon") continue;
1228
1266
  const ver = VERSION_LABELS[t2.version] || t2.version;
1229
1267
  options.push({
1230
1268
  value: key,
@@ -1242,7 +1280,7 @@ async function selectFromAll() {
1242
1280
  });
1243
1281
  if (p.isCancel(selected)) process.exit(0);
1244
1282
  if (selected === "back_to_mode") return await selectTemplateMethod();
1245
- const t = allTemplates[selected];
1283
+ const t = availableTemplates[selected];
1246
1284
  return { key: selected, ...t };
1247
1285
  }
1248
1286
  async function configureProject(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agile-team/robot-cli",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "现代化项目脚手架工具,支持多技术栈快速创建项目 - 优先 bun,兼容 npm/pnpm/yarn",
5
5
  "type": "module",
6
6
  "bin": {