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.
@@ -4,6 +4,7 @@
4
4
  // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
5
5
  "version": "0.2.0",
6
6
  "configurations": [
7
+
7
8
  {
8
9
  "type": "pwa-node",
9
10
  "request": "launch",
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
- if (process.argv.length > 2) {
32
- var arr = [...process.argv];
33
- // 支持根据参数传入web地址,开发环境是地址1,构建环境是地址2,而配置是写死的,通过参数灵活指定
34
- if (arr.includes('-webPath')) {
35
- var index = arr.indexOf('-webPath');
36
- var webPath = arr[index + 1];
37
- if (!webPath) throw new Error('-webPath参数缺少参数值');
38
- config.webPath = webPath;
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.26",
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:、\newcrabadoc\\www"
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": {
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 = [];