@taole/deploy-helper 0.5.4 → 0.5.6

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.mjs +14 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -15,6 +15,14 @@ const __dirname = path.dirname(__filename);
15
15
 
16
16
 
17
17
  const TEST_SERVER_HOST = "192.168.0.35";
18
+
19
+ function fmtAssetsCommit(msg){
20
+ if(msg.startsWith("-#")){
21
+ return msg;
22
+ }
23
+ return `-#DH-1 ${msg}`;
24
+ }
25
+
18
26
  /**
19
27
  * 加载配置
20
28
  * @returns 配置对象
@@ -355,7 +363,8 @@ async function main() {
355
363
  if (!assetsStatus.isClean()) {
356
364
  canPushAssets = true;
357
365
  await assetsGit.add(".");
358
- const assetsCommit = `${config.assets.commit || "feat:部署资源文件"} by deploy-helper`;
366
+ let assetsCommit = `${config.assets.commit || "feat:部署资源文件"} by deploy-helper`;
367
+ assetsCommit = fmtAssetsCommit(assetsCommit);
359
368
  const assetsCommitResult = await assetsGit.commit(assetsCommit);
360
369
  log(`assets commit: ${assetsCommit}`);
361
370
  log(`assets commit: ${JSON.stringify(assetsCommitResult.summary)}`);
@@ -368,7 +377,8 @@ async function main() {
368
377
  if (!entryStatus.isClean()) {
369
378
  canPushEntry = true;
370
379
  await entryGit.add(".");
371
- const entryCommit = `${config.entry.commit || "feat:部署入口文件"} by deploy-helper`;
380
+ let entryCommit = `${config.entry.commit || "feat:部署入口文件"} by deploy-helper`;
381
+ entryCommit = fmtAssetsCommit(entryCommit);
372
382
  const entryCommitResult = await entryGit.commit(entryCommit);
373
383
  log(`entry commit: ${entryCommit}`);
374
384
  log(`entry commit: ${JSON.stringify(entryCommitResult.summary)}`);
@@ -383,6 +393,7 @@ async function main() {
383
393
  try {
384
394
  await assetsGit.push();
385
395
  } catch (error) {
396
+ await assetsGit.pull();
386
397
  await assetsGit.push();
387
398
  }
388
399
  log(`assets push done.`);
@@ -392,6 +403,7 @@ async function main() {
392
403
  try {
393
404
  await entryGit.push();
394
405
  } catch (error) {
406
+ await entryGit.pull();
395
407
  await entryGit.push();
396
408
  }
397
409
  log(`entry push done.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/deploy-helper",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "脚本部署工具,用于将项目部署到测试环境或生产环境",
5
5
  "main": "index.mjs",
6
6
  "type": "module",