crabatool 1.0.116 → 1.0.123

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.116",
3
+ "version": "1.0.123",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tool/checkjs.js CHANGED
@@ -175,15 +175,15 @@ module.exports.start = async function() {
175
175
  info.push(`| 忽略目录和文件 | ${config.ignoreCheck ? config.ignoreCheck.join('、') : '无' + ' |'}`);
176
176
 
177
177
  info.push("# 检测结果汇总");
178
- info.push("| 类型 | 数量 |");
179
- info.push("| ------ | ------ |");
180
- info.push(`| 语法异常文件数Error | ${errKeys.length}个 |`);
181
- info.push(`| 语法警告文件数Warn | ${warnKeys.length}个 |`);
182
- info.push(`| 语法提示文件数Info | ${warnKeys.length}个 |`);
183
- info.push(`| 非utf8文件数 | ${notUtf8List.length}个 |`);
184
- info.push(`| 超过${fileSize}kb的文件数 | ${bigList.length}个 |`);
185
- info.push(`| gspx建议优化数 | ${warnGspxCount}个 |`);
186
- info.push(`| gspx语法错误数 | ${gspxData.errorList.length}个 |`);
178
+ info.push("| 类型 | 数量 | 占比 |");
179
+ info.push("| ------ | ------ | ----- |");
180
+ info.push(`| 语法异常文件数Error | ${errKeys.length}个 |${calc(errKeys.length, jsFiles.length)}|`);
181
+ info.push(`| 语法警告文件数Warn | ${warnKeys.length}个 |${calc(warnKeys.length, jsFiles.length)}|`);
182
+ info.push(`| 语法提示文件数Info | ${infoKeys.length}个 |${calc(infoKeys.length, jsFiles.length)}|`);
183
+ info.push(`| 非utf8文件数 | ${notUtf8List.length}个 |${calc(notUtf8List.length, jsFiles.length)}|`);
184
+ info.push(`| 超过${fileSize}kb的文件数 | ${bigList.length}个 |${calc(bigList.length, jsFiles.length)}|`);
185
+ info.push(`| gspx建议优化数 | ${warnGspxCount}个 |${calc(warnGspxCount, gspxData.count)}|`);
186
+ info.push(`| gspx语法错误数 | ${gspxData.errorList.length}个 |${calc(gspxData.errorList.length, gspxData.count)}|`);
187
187
 
188
188
 
189
189
  webhookList.push(`1. 助手版本: ${config.Version} `);
@@ -196,7 +196,7 @@ module.exports.start = async function() {
196
196
 
197
197
  // 输出到钉钉的简易报告
198
198
  //if (errKeys.length > 0) {
199
- webhookList.push(`1. 语法异常文件数Error:${errKeys.length}个`);
199
+ webhookList.push(`1. 语法异常文件数Error:${errKeys.length}个,占比${calc(errKeys.length, jsFiles.length)}`);
200
200
 
201
201
  // 随机显示5个异常文件到钉钉消息
202
202
  var errCount = errKeys.length;
@@ -209,7 +209,7 @@ module.exports.start = async function() {
209
209
  list0.push(fileName);
210
210
  }
211
211
 
212
- webhookList.push(`1. 语法异常文件清单随机5个 \r\n${list0.join(' \r\n')}`);
212
+ webhookList.push(`1. 随机显示部分异常文件清单 \r\n${list0.join('; \r\n')}`);
213
213
  var reportUrl1 = getReportUrl(id, 2);
214
214
  if (reportUrl1) {
215
215
  webhookList.push(`[更多异常...](${reportUrl1})`);
@@ -218,20 +218,20 @@ module.exports.start = async function() {
218
218
 
219
219
  //}
220
220
  //if (warnKeys.length > 0) {
221
- webhookList.push(`7. 语法警告文件数Warn:${warnKeys.length}个`);
221
+ webhookList.push(`7. 语法警告文件数Warn:${warnKeys.length}个,占比${calc(warnKeys.length, jsFiles.length)}`);
222
222
  //}
223
- webhookList.push(`8. 语法提示文件数Info:${infoKeys.length}个`);
223
+ webhookList.push(`8. 语法提示文件数Info:${infoKeys.length}个,占比${calc(infoKeys.length, jsFiles.length)}`);
224
224
  if (notUtf8List.length > 0) {
225
- webhookList.push(`1. 非utf8文件数:${notUtf8List.length}个`);
225
+ webhookList.push(`1. 非utf8文件数:${notUtf8List.length}个,占比${calc(notUtf8List.length, jsFiles.length)}`);
226
226
  }
227
227
  if (bigList.length > 0) {
228
- webhookList.push(`1. 超过${fileSize}kb的文件数:${bigList.length}个`);
228
+ webhookList.push(`1. 超过${fileSize}kb的文件数:${bigList.length}个,占比${calc(bigList.length, jsFiles.length)}`);
229
229
  }
230
230
  //if (warnGspxCount > 0) {
231
- webhookList.push(`9. gspx建议优化数:${warnGspxCount}个`);
231
+ webhookList.push(`9. gspx建议优化数:${warnGspxCount}个,占比${calc(warnGspxCount, gspxData.count)}`);
232
232
  //}
233
233
  if (gspxData.errorList.length > 0) {
234
- webhookList.push(`10. gspx语法错误数:${gspxData.errorList.length}个`);
234
+ webhookList.push(`10. gspx语法错误数:${gspxData.errorList.length}个,占比${calc(gspxData.errorList.length, gspxData.count)}`);
235
235
  }
236
236
 
237
237
  // 代码质量管理需要格式
@@ -385,6 +385,10 @@ async function eslintCheck(content) {
385
385
  return res;
386
386
  }
387
387
 
388
+ function calc(a, b) {
389
+ return Math.ceil(a / b * 100) + '%';
390
+ }
391
+
388
392
  function getMathReuslts(content, nreg, filterFun) {
389
393
  var all = content.matchAll(nreg);
390
394
  var list = [];
package/tool/ngptool.js CHANGED
@@ -16,10 +16,7 @@ function mergeBiz(childPath) {
16
16
  }
17
17
  utils.log('biz.js打包启动:' + bizPath);
18
18
 
19
- var watcher = chokidar.watch([bizPath], {
20
- persistent: true,
21
- usePolling: true
22
- });
19
+
23
20
 
24
21
  var watchAction = function() {
25
22
  utils.debug('打包中');
@@ -33,6 +30,11 @@ function mergeBiz(childPath) {
33
30
 
34
31
  // 只打包的情况就不监视文件
35
32
  if (!config.mergeinitjs) {
33
+ var watcher = chokidar.watch([bizPath], {
34
+ persistent: true,
35
+ usePolling: true
36
+ });
37
+
36
38
  watcher
37
39
  .on('ready', () => utils.debug(`${bizPath},Initial scan complete. Ready for changes.`))
38
40
  //.on('add', path => log(`File ${path} has been added`))