crabatool 1.0.94 → 1.0.95
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/checkjs.js +2 -1
- package/tool/install.js +21 -10
package/package.json
CHANGED
package/tool/checkjs.js
CHANGED
|
@@ -90,7 +90,8 @@ module.exports.start = async function() {
|
|
|
90
90
|
if (eslintResults.length > 0 && eslintResults[0].errorCount > 0) {
|
|
91
91
|
var res = eslintResults[0];
|
|
92
92
|
res.messages.forEach((item) => {
|
|
93
|
-
|
|
93
|
+
var reg = new RegExp(/'\$\w+'\sis\snot\sdefined\./);
|
|
94
|
+
if (reg.test(item.message)) return; // $字符开头的全局变量不输出
|
|
94
95
|
errInfo.list.push({ char: item.ruleId + ',' + item.messageId, line: item.line, endLine: item.endLine, column: item.column, msg: item.message });
|
|
95
96
|
});
|
|
96
97
|
|
package/tool/install.js
CHANGED
|
@@ -71,24 +71,35 @@ class Install {
|
|
|
71
71
|
var xmldata = JSON.parse(xmljs.xml2json(xml, { compact: true, spaces: 2 }));
|
|
72
72
|
|
|
73
73
|
var add = false;
|
|
74
|
+
var save = false;
|
|
74
75
|
var xn = utils.selectSingleNode(xmldata, "/application/component/extensionMap");
|
|
75
76
|
if (!xn) {
|
|
76
|
-
xn = { mapping:
|
|
77
|
+
xn = { mapping: { _attributes: { ext: 'gspx', type: 'XML' } } };
|
|
77
78
|
utils.addSingleNode(xmldata, "/application/component/extensionMap", xn);
|
|
78
|
-
|
|
79
|
+
save = true;
|
|
79
80
|
} else {
|
|
80
|
-
if (!xn.mapping) xn.mapping =
|
|
81
|
-
|
|
82
|
-
if (
|
|
81
|
+
if (!xn.mapping) xn.mapping = { _attributes: { ext: 'gspx', type: 'XML' } };
|
|
82
|
+
|
|
83
|
+
if (xn.mapping instanceof Array) {
|
|
84
|
+
var child = xn.mapping.filter(data => { return data._attributes.ext == 'gspx'; });
|
|
85
|
+
add = child.length == 0;
|
|
86
|
+
} else if (xn.mapping._attributes.ext == 'gspx') {
|
|
87
|
+
xn.mapping._attributes.type = 'XML';
|
|
88
|
+
save = true;
|
|
89
|
+
} else {
|
|
90
|
+
var old = JSON.parse(JSON.stringify(xn.mapping));
|
|
91
|
+
xn.mapping = [];
|
|
92
|
+
xn.mapping.push(old);
|
|
93
|
+
add = true;
|
|
94
|
+
}
|
|
83
95
|
}
|
|
84
96
|
|
|
85
97
|
if (add) {
|
|
86
|
-
xn.mapping.push({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
});
|
|
98
|
+
xn.mapping.push({ _attributes: { ext: 'gspx', type: 'XML' } });
|
|
99
|
+
save = true;
|
|
100
|
+
}
|
|
91
101
|
|
|
102
|
+
if (save) {
|
|
92
103
|
xml = xmljs.json2xml(xmldata, { compact: true, ignoreComment: true, spaces: 2 });
|
|
93
104
|
fs.writeFileSync(fileTypes, xml);
|
|
94
105
|
}
|