crabatool 1.0.401 → 1.0.406

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
@@ -126,6 +126,14 @@ function checkFast(args) {
126
126
  return false;
127
127
  }
128
128
 
129
+ // 按替换规则给指定文件生成版本号
130
+ if (args.includes('-addVersion')) {
131
+ start.bindAndCheckConfig('-file');
132
+ start.bindAndCheckConfig('-exp');
133
+ require('./tool/addVersion.js').run();
134
+ return false;
135
+ }
136
+
129
137
  // crabatool -upload -host 接收地址 -webPath 平台源码根路径
130
138
  if (args.includes('-upload')) {
131
139
  start.bindAndCheckConfig('-targetPath');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.401",
3
+ "version": "1.0.406",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -26,7 +26,8 @@
26
26
  "aiconfont": "node ./test/test.js -iconfont -zipPath F:\\crabaevery\\www\\iconfont -fontPath F:\\CarpaNET_NEW\\src\\Carpa.Web\\skins -prefix .aicon- -fontName iconfont",
27
27
  "makeHash": "node run.js -makeHash -webPath ./test/ -modName craba -files http://crabadoc.ca.com/js/utils/utils.js,F:/newcrabadoc/www/js/utils/utils.js,./test/test.js,./test/beefun.js,https://s5.vip.wpscdn.cn/web-libs/2t/js/userinfo-collect/1.0.3/vas2t-userinfo-collect.min.js?a=1 -outJson ./hash.json -hashName sha384",
28
28
  "makeHash2": "node run.js -makeHash -webPath ./test/ -modName craba -files ./test/ -exts .js -outJson ./hash2.json -hashName sha384",
29
- "pageHash": "node run.js -pageHash /Test/TestMasterDetail.gspx"
29
+ "pageHash": "node run.js -pageHash /Test/TestMasterDetail.gspx",
30
+ "addVersion":"node run.js -addVersion -file F:\\basicweb\\www\\index.html -exp AUTOVERSION"
30
31
  },
31
32
  "author": "wssf",
32
33
  "dependencies": {
@@ -0,0 +1,18 @@
1
+
2
+ var config = require('../lib/config.js');
3
+ var path = require('path');
4
+ var fs = require('fs');
5
+ var utils = require('../lib/utils.js');
6
+
7
+ module.exports.run = function() {
8
+ if (!fs.existsSync(config.file)) {
9
+ throw new Error('file文件不存在');
10
+ }
11
+
12
+ var replaceStr = config.exp || 'AUTOVERSION'
13
+ var content = fs.readFileSync(config.file).toString();
14
+ var v = new Date().getTime();
15
+ content = content.replace(replaceStr, v);
16
+ fs.writeFileSync(config.file, content);
17
+ console.log('自动生成版本号完成:' + v);
18
+ }