crabatool 1.0.114 → 1.0.117
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/test/test.js +4 -3
- package/tool/checkjs.js +2 -3
- package/tool/ngptool.js +20 -8
package/package.json
CHANGED
package/test/test.js
CHANGED
|
@@ -9,7 +9,8 @@ var crabaTool = require('../index.js'); // 引入craba脚手架工具包
|
|
|
9
9
|
var config = {
|
|
10
10
|
//【必填】
|
|
11
11
|
// 告诉工具当前项目的端路径地址,填绝对路径哦
|
|
12
|
-
webPath: "F
|
|
12
|
+
webPath: "F:\\jxc\\jxc-web\\src\\main\\resources\\static\\jxc",
|
|
13
|
+
//webPath: "F:/shell_master/web/src/main/resources/static/shell",
|
|
13
14
|
//webPath: "F:\\newcrabadoc\\www",
|
|
14
15
|
//webPath: "F:\\CarpaNET_NEW\\src\\Carpa.Web\\js\\",
|
|
15
16
|
|
|
@@ -19,7 +20,7 @@ var config = {
|
|
|
19
20
|
|
|
20
21
|
//【ngp必填】【非ngp项目不是必填】
|
|
21
22
|
// 当前项目模块名称,各组按需修改
|
|
22
|
-
modName: "
|
|
23
|
+
modName: "jxc", // 如:modName:"jxc"
|
|
23
24
|
|
|
24
25
|
defaultPage: 'index.html',
|
|
25
26
|
|
|
@@ -31,7 +32,7 @@ var config = {
|
|
|
31
32
|
// 1. 当前模块是由哪些过去的模块合并来的,各组按需修改
|
|
32
33
|
// 2. 如果配置了子模块清单,工具会自动将所有子模块下的init.js和当前模块的jxc/js/jxc.js,合并打包到:jxc/js/init.js,实际运行过程中只加载:jxc/js/init.js,不会加载子模块下面的init.js,这样就可以大大减少http请求
|
|
33
34
|
// 3. 同2,biz.js也是相同思路进行合并打包
|
|
34
|
-
childModList: ['recordsheet', 'baseinfo', 'accounting'],
|
|
35
|
+
childModList: ['recordsheet', 'baseinfo', 'accounting', 'analysiscloud', 'finance'],
|
|
35
36
|
|
|
36
37
|
// 【不是必填】
|
|
37
38
|
// 上一步中打包后的文件是否压缩, true为忽略【不压缩】,false为【要压缩】,各组按需修改
|
package/tool/checkjs.js
CHANGED
|
@@ -153,8 +153,8 @@ module.exports.start = async function() {
|
|
|
153
153
|
status = '有异常';
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
|
|
157
156
|
var modName = getModName();
|
|
157
|
+
var id = modName + '_' + new Date().getTime();
|
|
158
158
|
var webhookList = [];
|
|
159
159
|
var info = [];
|
|
160
160
|
var localVersion = upgrade.getLocalVersion();
|
|
@@ -209,7 +209,7 @@ module.exports.start = async function() {
|
|
|
209
209
|
list0.push(fileName);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
webhookList.push(`1. 语法异常文件清单随机5个 \r\n${list0.join(' \r\n')}
|
|
212
|
+
webhookList.push(`1. 语法异常文件清单随机5个 \r\n${list0.join('; \r\n')}`);
|
|
213
213
|
var reportUrl1 = getReportUrl(id, 2);
|
|
214
214
|
if (reportUrl1) {
|
|
215
215
|
webhookList.push(`[更多异常...](${reportUrl1})`);
|
|
@@ -350,7 +350,6 @@ module.exports.start = async function() {
|
|
|
350
350
|
|
|
351
351
|
|
|
352
352
|
// 推送报告到钉钉和文档服务器端
|
|
353
|
-
var id = modName + '_' + new Date().getTime();
|
|
354
353
|
var reportUrl = getReportUrl(id);
|
|
355
354
|
var content = info.concat(detail).join(' \r\n');
|
|
356
355
|
postReport(id, reportUrl, content, sonar);
|
package/tool/ngptool.js
CHANGED
|
@@ -9,11 +9,12 @@ var mergeJs = utils.join(__dirname, 'merge.js');
|
|
|
9
9
|
var compressArgs = config.ignoreCompress ? ['-ignorecompress'] : []; // 是否压缩
|
|
10
10
|
|
|
11
11
|
// 打包biz.js
|
|
12
|
-
function mergeBiz() {
|
|
13
|
-
var bizPath = utils.join(config.webPath,
|
|
12
|
+
function mergeBiz(childPath) {
|
|
13
|
+
var bizPath = utils.join(config.webPath, childPath);
|
|
14
14
|
if (!fs.existsSync(bizPath)) {
|
|
15
|
-
return utils.error('
|
|
15
|
+
return utils.error('biz.js关联打包的路径不存在,如需打包请先创建目录:' + bizPath);
|
|
16
16
|
}
|
|
17
|
+
utils.log('biz.js打包启动:' + bizPath);
|
|
17
18
|
|
|
18
19
|
var watcher = chokidar.watch([bizPath], {
|
|
19
20
|
persistent: true,
|
|
@@ -23,9 +24,10 @@ function mergeBiz() {
|
|
|
23
24
|
var watchAction = function() {
|
|
24
25
|
utils.debug('打包中');
|
|
25
26
|
// 这里进行文件更改后的操作
|
|
26
|
-
var
|
|
27
|
+
var bizJs = utils.join(bizPath, '../', 'biz.js');
|
|
28
|
+
var p = fork(mergeJs, [`${[bizPath]}`, `${[bizJs]}`, compressArgs])
|
|
27
29
|
p.on('exit', code => {
|
|
28
|
-
utils.
|
|
30
|
+
utils.log('打包完成:' + bizJs);
|
|
29
31
|
});
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -53,9 +55,10 @@ function mergeInit() {
|
|
|
53
55
|
var watchAction = function() {
|
|
54
56
|
utils.debug('打包中');
|
|
55
57
|
// 这里进行文件更改后的操作
|
|
56
|
-
var
|
|
58
|
+
var initJs = utils.join(config.webPath, '/js/init.js');
|
|
59
|
+
var p = fork(mergeJs, [`${[inits]}`, `${[initJs]}`, compressArgs])
|
|
57
60
|
p.on('exit', code => {
|
|
58
|
-
utils.
|
|
61
|
+
utils.log('打包完成:' + initJs);
|
|
59
62
|
});
|
|
60
63
|
}
|
|
61
64
|
|
|
@@ -94,5 +97,14 @@ function mergeInit() {
|
|
|
94
97
|
utils.log('启动打包服务', config.childModList);
|
|
95
98
|
utils.mkdirsSync(config.webPath);
|
|
96
99
|
|
|
97
|
-
|
|
100
|
+
// 打包当前模块的biz.js
|
|
101
|
+
mergeBiz('/js/biz');
|
|
102
|
+
|
|
103
|
+
// 打包子模块的biz.js
|
|
104
|
+
config.childModList.forEach(childName => {
|
|
105
|
+
var childBiz = utils.join(childName, 'js/biz');
|
|
106
|
+
mergeBiz(childBiz);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// 打包模块的init.js
|
|
98
110
|
mergeInit(); // 如果有需要
|