crabatool 1.0.103 → 1.0.107

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.103",
3
+ "version": "1.0.107",
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给与提示
@@ -156,12 +157,17 @@ module.exports.start = async function() {
156
157
  var modName = getModName();
157
158
  var webhookList = [];
158
159
  var info = [];
160
+ var localVersion = upgrade.getLocalVersion();
159
161
  info.push(`# ${modName}代码检测报告`);
160
162
  webhookList.push(info[0]);
161
163
 
162
164
  info.push("| 名称 | 结果 |");
163
165
  info.push("| ------ | ------ |");
164
166
  info.push(`| 助手版本 | ${config.Version} |`);
167
+ if (localVersion.version) {
168
+ info.push(`| 平台版本 | ${localVersion.version} |`);
169
+ info.push(`| 平台日期 | ${localVersion.date} |`);
170
+ }
165
171
  info.push(`| 生成报告时间 | ${new Date().toString()} |`);
166
172
  info.push(`| 网站路径 | ${config.webPath} |`);
167
173
  info.push(`| 共检查 | ${jsFiles.length}个js文件 |`);
@@ -181,8 +187,12 @@ module.exports.start = async function() {
181
187
 
182
188
 
183
189
  webhookList.push(`1. 助手版本: ${config.Version} `);
184
- webhookList.push(`1. 共检测 ${jsFiles.length}个js文件 `);
185
- webhookList.push(`1. 共检测 ${gspxData.count}个gspx文件 `);
190
+ if (localVersion.version) {
191
+ webhookList.push(`1. 平台版本:${localVersion.version}`);
192
+ webhookList.push(`1. 平台日期:${localVersion.date}`);
193
+ }
194
+ webhookList.push(`1. 共检测 ${jsFiles.length}个 js文件 `);
195
+ webhookList.push(`1. 共检测 ${gspxData.count}个 gspx文件 `);
186
196
 
187
197
  // 输出到钉钉的简易报告
188
198
  //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
  }