crabatool 1.0.26 → 1.0.29
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/.vscode/launch.json +1 -0
- package/index.js +20 -9
- package/lib/utils.js +3 -4
- package/package.json +2 -2
- package/test/{ngp.js → craba.js} +0 -0
- package/tool/checkjs.js +1 -1
package/.vscode/launch.json
CHANGED
package/index.js
CHANGED
|
@@ -27,16 +27,27 @@ module.exports.run = function(options) {
|
|
|
27
27
|
waitInput();
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
function bindConfigByArgv(key) {
|
|
31
|
+
if (process.argv.length < 3) return null;
|
|
32
|
+
|
|
33
|
+
var arr = [...process.argv];
|
|
34
|
+
if (arr.includes(key)) {
|
|
35
|
+
var index = arr.indexOf(key);
|
|
36
|
+
var value = arr[index + 1];
|
|
37
|
+
if (!value) throw new Error(key + '参数缺少参数值');
|
|
38
|
+
key = key.substr(1);
|
|
39
|
+
config[key] = value;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
30
42
|
function checkConfig() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
43
|
+
bindConfigByArgv('-webPath');
|
|
44
|
+
bindConfigByArgv('-port');
|
|
45
|
+
bindConfigByArgv('-modName');
|
|
46
|
+
bindConfigByArgv('-ignoreCheck');
|
|
47
|
+
bindConfigByArgv('-webhooks');
|
|
48
|
+
|
|
49
|
+
if (config.ignoreCheck && typeof config.ignoreCheck == 'string') {
|
|
50
|
+
config.ignoreCheck = config.ignoreCheck.split(',');
|
|
40
51
|
}
|
|
41
52
|
|
|
42
53
|
if (!config.webPath) {
|
package/lib/utils.js
CHANGED
|
@@ -359,18 +359,17 @@ class Utils {
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
getFiles(options, fileList) {
|
|
362
|
-
var ignores = options.ignores;
|
|
363
362
|
var exts = options.exts;
|
|
364
363
|
var source = options.source;
|
|
365
|
-
if (ignores && !fileList) {
|
|
366
|
-
ignores = ignores.map((item) => { return path.join(source, item) });
|
|
364
|
+
if (options.ignores && !fileList) {
|
|
365
|
+
options.ignores = options.ignores.map((item) => { return path.join(source, item) });
|
|
367
366
|
}
|
|
368
367
|
|
|
369
368
|
if (!fileList) fileList = [];
|
|
370
369
|
var files = fs.readdirSync(source);
|
|
371
370
|
files.forEach(function(fileName) {
|
|
372
371
|
var filePath = path.join(source, fileName);
|
|
373
|
-
if (ignores && ignores.includes(filePath)) {
|
|
372
|
+
if (options.ignores && options.ignores.includes(filePath)) {
|
|
374
373
|
return;
|
|
375
374
|
}
|
|
376
375
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crabatool",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"description": "crabatool",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"test": "node ./test/test.js",
|
|
9
9
|
"run": "node ./test/test.js -run",
|
|
10
10
|
"checkjs": "node ./test/test.js -checkjs",
|
|
11
|
-
"webPath": "node ./test/test.js -checkjs -webPath F
|
|
11
|
+
"webPath": "node ./test/test.js -checkjs -webPath F:\\crabaevery\\www -modName crabademo -ignoreCheck ueditor,iconfont,biconfont,js\\math.min.js,js\\es6-promise.auto.min.js,js\\craba.rollup.min.js"
|
|
12
12
|
},
|
|
13
13
|
"author": "wssf",
|
|
14
14
|
"dependencies": {
|
package/test/{ngp.js → craba.js}
RENAMED
|
File without changes
|
package/tool/checkjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var path = require('path');
|
|
|
8
8
|
var axios = require('axios');
|
|
9
9
|
|
|
10
10
|
module.exports.start = function() {
|
|
11
|
-
var jsFiles = utils.getFiles({ source: config.webPath, exts: '.js' });
|
|
11
|
+
var jsFiles = utils.getFiles({ source: config.webPath, exts: '.js', ignores: config.ignoreCheck });
|
|
12
12
|
|
|
13
13
|
var fileSize = 300;
|
|
14
14
|
var errList = [];
|