crabatool 1.0.435 → 1.0.437
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 +1 -1
- package/tool/checkgspx.js +43 -14
- package/tool/checkjs.js +2 -1
package/package.json
CHANGED
package/tool/checkgspx.js
CHANGED
|
@@ -9,6 +9,7 @@ module.exports.getResults = function() {
|
|
|
9
9
|
var data = {
|
|
10
10
|
count: 0,
|
|
11
11
|
tags: {},
|
|
12
|
+
bizList: {},
|
|
12
13
|
tagList: [],
|
|
13
14
|
customs1: {},
|
|
14
15
|
customs2: {},
|
|
@@ -49,6 +50,7 @@ function readGspxToJSON(fileName, data) {
|
|
|
49
50
|
if (!byte.toString().trim().startsWith('<?xml')) {
|
|
50
51
|
data.errorList.push({ fileName: fileName, tag: '', error: 'gspx文件第一行必须是:<?xml version="1.0" encoding="UTF-8"?>' });
|
|
51
52
|
}
|
|
53
|
+
fileName = utils.joinSep(fileName.replaceAll('\\', '/'));
|
|
52
54
|
|
|
53
55
|
function HtmlParser2ToXml(xml) {
|
|
54
56
|
var parser = new htmlparser2.Parser({
|
|
@@ -65,25 +67,35 @@ function readGspxToJSON(fileName, data) {
|
|
|
65
67
|
data.tags[name]++;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
if (config.checkCustomControl) {
|
|
71
|
+
// 统计customs
|
|
72
|
+
if (name == 'CustomControl') {
|
|
73
|
+
if (attrs.Src) {
|
|
74
|
+
// 统计当前页面引用了哪些CustomControl
|
|
75
|
+
var key2 = utils.joinSep(attrs.Src.replace('~', '').replace('..', ''));
|
|
76
|
+
if (!data.customs1[fileName]) {
|
|
77
|
+
data.customs1[fileName] = [];
|
|
78
|
+
}
|
|
79
|
+
data.customs1[fileName].push(key2);
|
|
80
|
+
|
|
81
|
+
// 统计某个CustomControl被哪些页面引用
|
|
82
|
+
if (!data.customs2[key2]) {
|
|
83
|
+
data.customs2[key2] = [];
|
|
84
|
+
}
|
|
85
|
+
data.customs2[key2].push(fileName);
|
|
76
86
|
}
|
|
77
|
-
|
|
87
|
+
}
|
|
78
88
|
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
data.
|
|
89
|
+
for (var key in attrs) {
|
|
90
|
+
if (key == 'Business') {
|
|
91
|
+
addBiz(data.bizList, attrs[key], fileName);
|
|
92
|
+
break;
|
|
93
|
+
} else if (key == 'BusinessEx') {
|
|
94
|
+
addBiz(data.bizList, attrs[key], fileName);
|
|
95
|
+
break;
|
|
82
96
|
}
|
|
83
|
-
data.customs2[key2].push(key1);
|
|
84
97
|
}
|
|
85
98
|
}
|
|
86
|
-
|
|
87
99
|
// 建议优化页面汇总
|
|
88
100
|
if (warnTags.includes(name)) {
|
|
89
101
|
if (name == 'CancelButton' || name == 'CloseButton') {
|
|
@@ -129,4 +141,21 @@ function readGspxToJSON(fileName, data) {
|
|
|
129
141
|
HtmlParser2ToXml(gspxXML);
|
|
130
142
|
|
|
131
143
|
return rootNode;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function addBiz(bizList, bizName, fileName) {
|
|
147
|
+
if (!bizName) return;
|
|
148
|
+
try {
|
|
149
|
+
var s = bizName.replaceAll("'", '"');
|
|
150
|
+
var bizData = JSON.parse(s);
|
|
151
|
+
bizName = bizData.Name;
|
|
152
|
+
} catch (ex) { }
|
|
153
|
+
|
|
154
|
+
if (bizName.indexOf('.') < 0) {
|
|
155
|
+
bizName = config.modName + '.' + bizName;
|
|
156
|
+
}
|
|
157
|
+
if (!bizList[bizName]) {
|
|
158
|
+
bizList[bizName] = [];
|
|
159
|
+
}
|
|
160
|
+
bizList[bizName].push(fileName);
|
|
132
161
|
}
|
package/tool/checkjs.js
CHANGED
|
@@ -732,7 +732,7 @@ function postReportData(data) {
|
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
function postBaseData(data0, gspxData) {
|
|
735
|
-
if(!config.checkCustomControl){
|
|
735
|
+
if (!config.checkCustomControl) {
|
|
736
736
|
return;
|
|
737
737
|
}
|
|
738
738
|
axios({
|
|
@@ -741,6 +741,7 @@ function postBaseData(data0, gspxData) {
|
|
|
741
741
|
data: {
|
|
742
742
|
customs1: gspxData.customs1,
|
|
743
743
|
customs2: gspxData.customs2,
|
|
744
|
+
bizList: gspxData.bizList,
|
|
744
745
|
branchName: data0.branchName,
|
|
745
746
|
projectName: data0.projectName
|
|
746
747
|
},
|