crabatool 1.0.101 → 1.0.105

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.101",
3
+ "version": "1.0.105",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tool/checkjs.js CHANGED
@@ -7,6 +7,7 @@ var path = require('path');
7
7
  var axios = require('axios');
8
8
  var gspx = require('./checkgspx.js');
9
9
  var eslint = require('eslint');
10
+ const upgrade = require('./upgrade.js');
10
11
 
11
12
 
12
13
  // js超过多少kb给与提示
@@ -103,6 +104,9 @@ module.exports.start = async function() {
103
104
  } else if (item.ruleId.indexOf('native-ie') > -1 || item.ruleId.indexOf('no-dupe-keys') > -1) {
104
105
  list = ieList;
105
106
  } else if (item.ruleId.indexOf('no-unused-vars') > -1) {
107
+ if (item.message && (item.message.indexOf("'sender'") > -1 || item.message.indexOf("'eventArgs'") > -1) || item.message.indexOf("'args'") > -1) {
108
+ return;
109
+ }
106
110
  list = infoList;
107
111
  }
108
112
  list.push({ char: item.ruleId + ',' + item.messageId, line: item.line, endLine: item.endLine, column: item.column, msg: item.message });
@@ -153,12 +157,14 @@ module.exports.start = async function() {
153
157
  var modName = getModName();
154
158
  var webhookList = [];
155
159
  var info = [];
160
+ var localVersion = upgrade.getLocalVersion();
156
161
  info.push(`# ${modName}代码检测报告`);
157
162
  webhookList.push(info[0]);
158
163
 
159
164
  info.push("| 名称 | 结果 |");
160
165
  info.push("| ------ | ------ |");
161
166
  info.push(`| 助手版本 | ${config.Version} |`);
167
+ if (localVersion.version) info.push(`| 平台版本和日期 | ${localVersion.version}和${localVersion.date} |`);
162
168
  info.push(`| 生成报告时间 | ${new Date().toString()} |`);
163
169
  info.push(`| 网站路径 | ${config.webPath} |`);
164
170
  info.push(`| 共检查 | ${jsFiles.length}个js文件 |`);
@@ -178,8 +184,9 @@ module.exports.start = async function() {
178
184
 
179
185
 
180
186
  webhookList.push(`1. 助手版本: ${config.Version} `);
181
- webhookList.push(`1. 共检测 ${jsFiles.length}个js文件 `);
182
- webhookList.push(`1. 共检测 ${gspxData.count}个gspx文件 `);
187
+ if (localVersion.version) webhookList.push(`1. 平台版本和日期:${localVersion.version}和${localVersion.date}`);
188
+ webhookList.push(`1. 共检测 ${jsFiles.length}个 js文件 `);
189
+ webhookList.push(`1. 共检测 ${gspxData.count}个 gspx文件 `);
183
190
 
184
191
  // 输出到钉钉的简易报告
185
192
  //if (errKeys.length > 0) {
package/tool/upgrade.js CHANGED
@@ -27,16 +27,19 @@ class Upgrade {
27
27
  getLocalVersion() {
28
28
  // 获取本地craba平台版本
29
29
  var crabaJs = utils.join(config.webPath, 'js/craba.min.js');
30
+ if (!fs.existsSync(crabaJs)) {
31
+ return { version: '', date: '' };
32
+ }
30
33
  var content = fs.readFileSync(crabaJs).toString();
31
34
 
32
35
  var m = content.match(new RegExp("crabaVersion = \\S*;"));
33
- var localVersion = "";
36
+ var localVersion = "";
34
37
  if (m) {
35
38
  localVersion = m[0].match(new RegExp("\\d*\\.\\d*\\.\\d*"))[0];
36
39
  }
37
40
 
38
41
  m = content.match(new RegExp("crabaDate = \\S* \\S*"));
39
- var vDate = "";
42
+ var vDate = "";
40
43
  if (m) {
41
44
  vDate = m[0].match(new RegExp("\\d*-\\d*-\\d*\\s\\d*:\\d*:\\d*"))[0];
42
45
  }