crabatool 1.0.819 → 1.0.820

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/lib/utils.js CHANGED
@@ -1237,7 +1237,7 @@ class Utils {
1237
1237
  * 在指定目录执行命令
1238
1238
  */
1239
1239
  async executeCommand(command, repoPath = config.webPath, timeout = 30000) {
1240
- this._log(`执行: ${command}`);
1240
+ console.log(`执行: ${command}`);
1241
1241
 
1242
1242
  try {
1243
1243
  const { stdout, stderr } = await execPromise(command, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.819",
3
+ "version": "1.0.820",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -93,13 +93,19 @@ function buildFolder(options) {
93
93
  if (config.exp) {
94
94
  var list = config.exp.split(';');
95
95
  list.forEach(function(item) {
96
+ if (!item) return;
96
97
  var arr = item.split('=');
97
- var key = arr[0].trim();
98
+ var key = (arr[0] || '').trim();
99
+ if (!key) return;
100
+
98
101
  var value;
99
102
  if (key == '$versionDate$') {
100
103
  value = new Date().toString('yyyyMMddhh');
101
- } else {
104
+ } else if (arr.length > 1 && arr[1] != null) {
102
105
  value = arr[1].trim();
106
+ } else {
107
+ utils.log('exp变量格式不正确,已忽略:' + item);
108
+ return;
103
109
  }
104
110
  content = content.replaceAll(key, value);
105
111
 
@@ -280,4 +286,4 @@ function copyByteToCache(filePath, content, stats, options) {
280
286
  utils.debug("拷贝到缓存:" + cachePath);
281
287
  fs.writeFileSync(cachePath, content, 'utf8');
282
288
  fs.utimesSync(cachePath, stats.atime, stats.mtime); // 必须同步文件时间
283
- }
289
+ }
package/tool/upgrade.js CHANGED
@@ -64,7 +64,7 @@ class Upgrade {
64
64
  console.log('没有git推送权限,取消craba的更新操作');
65
65
  return;
66
66
  }
67
-
67
+
68
68
  console.log('当前git有推送权限,开始检查更新craba');
69
69
 
70
70
  this.checkUpdateCrabaNext();
@@ -89,8 +89,6 @@ class Upgrade {
89
89
 
90
90
  var gitCmd = `git push origin ${branchName}`;
91
91
  console.log('🚀 执行推送测试是否有权限...');
92
- console.log(gitCmd);
93
-
94
92
  const pushResult = await utils.executeCommand(
95
93
  gitCmd,
96
94
  60000 // 推送可能需要更长时间