crabatool 1.0.38 → 1.0.39

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.
Files changed (2) hide show
  1. package/index.js +21 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4,6 +4,7 @@ var upgrade = require('./tool/upgrade.js');
4
4
  var fs = require('fs');
5
5
  var path = require('path');
6
6
  var readline = require('readline');
7
+ const { memoryUsage } = require('process');
7
8
 
8
9
  module.exports.run = function(options) {
9
10
  //console.log(process.argv);
@@ -11,6 +12,7 @@ module.exports.run = function(options) {
11
12
  console.log('平台助手启动参数:', options);
12
13
 
13
14
  Object.assign(config, options);
15
+
14
16
  checkConfig();
15
17
 
16
18
  // 1. 服务端构建环境,自动化,根据命令行参数,直接调用脚手架功能
@@ -20,6 +22,8 @@ module.exports.run = function(options) {
20
22
  return checkAllJs();
21
23
  } else if (arr.includes('-run')) {
22
24
  return start();
25
+ } else if (arr.includes('-mergeinitjs')) {
26
+ return mergeInit();
23
27
  }
24
28
  }
25
29
 
@@ -27,7 +31,7 @@ module.exports.run = function(options) {
27
31
  waitInput();
28
32
  }
29
33
 
30
- function bindConfigByArgv(key) {
34
+ function bindConfigByArgv(key, type) {
31
35
  if (process.argv.length < 3) return null;
32
36
 
33
37
  var arr = process.argv;
@@ -36,20 +40,25 @@ function bindConfigByArgv(key) {
36
40
  var value = arr[index + 1];
37
41
  if (!value) throw new Error(key + '参数缺少参数值');
38
42
  key = key.substr(1);
43
+
44
+ if (type == 'array') {
45
+ value = value.split(',');
46
+ } else if (type == 'boolean') {
47
+ value = value == 'false' || value == 0 ? false : true;
48
+ }
39
49
  config[key] = value;
40
50
  }
41
51
  }
52
+
42
53
  function checkConfig() {
43
54
  bindConfigByArgv('-webPath');
44
55
  bindConfigByArgv('-port');
45
56
  bindConfigByArgv('-modName');
46
- bindConfigByArgv('-ignoreCheck');
57
+ bindConfigByArgv('-ignoreCheck', 'array');
47
58
  bindConfigByArgv('-webhooks');
48
59
  bindConfigByArgv('-progress');
49
-
50
- if (config.ignoreCheck && typeof config.ignoreCheck == 'string') {
51
- config.ignoreCheck = config.ignoreCheck.split(',');
52
- }
60
+ bindConfigByArgv('-childModList', 'array');
61
+ bindConfigByArgv('-ignoreCompress', 'boolean');
53
62
 
54
63
  if (!config.webPath) {
55
64
  throw new Error('请检查craba.js,必须告诉工具当前项目的前端路径地址,填绝对路径哦');
@@ -190,6 +199,12 @@ function installvscode() {
190
199
  console.log('待实现');
191
200
  }
192
201
 
202
+ function mergeInit() {
203
+ if (config.modName && config.childModList && config.childModList.length > 0) {
204
+ require('../tool/ngptool.js');
205
+ }
206
+ }
207
+
193
208
  function checkAllJs() {
194
209
  require('./tool/checkjs.js').start();
195
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "scripts": {