@wx-sab/renkei 1.0.2 → 1.1.0

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.
@@ -143,13 +143,21 @@ const generateApis = (config, services // 指定服务
143
143
  // 进度条控制
144
144
  const progress = new cli_progress_1.default.SingleBar({});
145
145
  progress.start(_configs.length, 0);
146
+ let failedServices = []; // 统计失败服务
146
147
  try {
147
148
  for (var _d = true, _configs_1 = __asyncValues(_configs), _configs_1_1; _configs_1_1 = yield _configs_1.next(), _a = _configs_1_1.done, !_a; _d = true) {
148
149
  _c = _configs_1_1.value;
149
150
  _d = false;
150
151
  const conf = _c;
151
- yield (0, exports.generate)(conf);
152
- progress.increment(1);
152
+ try {
153
+ yield (0, exports.generate)(conf);
154
+ }
155
+ catch (e) {
156
+ failedServices.push(conf.serviceName);
157
+ }
158
+ finally {
159
+ progress.increment(1);
160
+ }
153
161
  }
154
162
  }
155
163
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -160,6 +168,8 @@ const generateApis = (config, services // 指定服务
160
168
  finally { if (e_1) throw e_1.error; }
161
169
  }
162
170
  progress.stop();
163
- console.info("✅ 执行完毕");
171
+ console.info(`✅ 执行完毕${failedServices.length
172
+ ? `,以下服务生成失败: ${failedServices.join("、")}`
173
+ : ""}`);
164
174
  });
165
175
  exports.generateApis = generateApis;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wx-sab/renkei",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "解析swagger转为ts代码,日本动漫《游戏王》中的‘Renkei’,意为连携或协作。",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
package/templates/api.ejs CHANGED
@@ -93,7 +93,7 @@ export class <%~ serviceName %> {
93
93
  <% routes.combined && routes.combined.forEach(({ routes = [], moduleName }) => { %>
94
94
  <% routes.forEach((route) => { %>
95
95
 
96
- <%~ includeFile('./procedure-call.eta', { ...it, route }) %>
96
+ <%~ includeFile('./procedure-call.ejs', { ...it, route }) %>
97
97
 
98
98
  <% }) %>
99
99
  <% }) %>
@@ -22,8 +22,19 @@ const requestConfigParam = {
22
22
  const getListItemType = (type) => type.replace(/\((\w+)\)\[\]/g, (match, key) => `${key}[]`)
23
23
 
24
24
  const getFullType = (type) => {
25
+ const originType = type;
26
+
27
+ // 处理列表list
28
+ const matchList = type.match(/\((\w+)\)\[\]/)
29
+ if (matchList) {
30
+ type = matchList[1]
31
+ }
32
+
25
33
  const matchType = modelTypes.find(t => (t.name || t.type) === type)
26
34
  if (!matchType) {
35
+ if (matchList) {
36
+ return originType
37
+ }
27
38
  return type
28
39
  }
29
40