crabatool 1.0.512 → 1.0.516

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/index.js CHANGED
@@ -217,7 +217,9 @@ async function checkFast(args) {
217
217
  // crabatool -upload -host 接收地址 -webPath 平台源码根路径
218
218
  if (args.includes('-upload')) {
219
219
  start.bindAndCheckConfig('-targetPath');
220
- require('./tool/compress.js').run(); // 打包压缩js和css
220
+ if (!require('./tool/compress.js').run()) {
221
+ return false;
222
+ } // 打包压缩js和css
221
223
  require('./tool/crabapublish.js').upload();
222
224
  return false;
223
225
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.512",
3
+ "version": "1.0.516",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "bin": {
package/tool/compress.js CHANGED
@@ -33,7 +33,7 @@ module.exports.run = function() {
33
33
 
34
34
  doCompress(); // 打包、压缩、合并js和css到临时目录下
35
35
 
36
- checkJsOk(); // 检查压缩后的js里面是否有黑名单替换(对部分内部使用的变量名替换为缩写的,_Z_xxx),遇到过一次发版没有替换,导致某些js插件(几年前发布的)依赖_Z_xx这些变量找不到。
36
+ return checkJsOk(); // 检查压缩后的js里面是否有黑名单替换(对部分内部使用的变量名替换为缩写的,_Z_xxx),遇到过一次发版没有替换,导致某些js插件(几年前发布的)依赖_Z_xx这些变量找不到。
37
37
  }
38
38
 
39
39
  module.exports.mergeFiles = function() {
@@ -61,17 +61,21 @@ module.exports.mergeCss = function() {
61
61
  }
62
62
 
63
63
  function checkJsOk() {
64
- checkJsHasZ('craba.min.js');
65
- checkJsHasZ('crabaEx.min.js');
66
- checkJsHasZ('crabaNgp.js');
64
+ if (!checkJsHasZ('craba.min.js')) return false;
65
+ if (!checkJsHasZ('crabaEx.min.js')) return false;
66
+ if (!checkJsHasZ('crabaNgp.js')) return false;
67
+ return true;
67
68
  }
68
69
 
69
70
  function checkJsHasZ(jsName) {
70
- var crabaJs = path.join(_tempJsPath, jsNanme);
71
+ var crabaJs = path.join(_tempJsPath, jsName);
71
72
  var contentJs = fs.readFileSync(crabaJs);
72
- if (contentJs.indexOf('_Z_') > 0) {
73
- throw new Error('test,test,test;upload craba失败,' + jsName + '文件的黑名单类名(_Z_)替换失败,终止打包和上传任务;请重试打包。');
73
+ if (contentJs.indexOf('_Z_') < 0) {
74
+ var tips = '发版警告!!!upload craba失败!!!' + jsName + '文件的黑名单类名(_Z_)替换失败,终止打包和上传任务;请重试打包。';
75
+ utils.postWeebhooks(tips);
76
+ return false;
74
77
  }
78
+ return true;
75
79
  }
76
80
 
77
81
  function updateCrabaVersion() {