@gmcb/cli 0.8.4 → 0.8.5

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.8.5](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.4...@gmcb/cli@0.8.5) (2026-07-15)
7
+
8
+ **Note:** Version bump only for package @gmcb/cli
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.8.4](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.3...@gmcb/cli@0.8.4) (2026-07-15)
7
15
 
8
16
  **Note:** Version bump only for package @gmcb/cli
@@ -305,14 +305,19 @@ async function fetchRemoteResources(opts) {
305
305
  // 4. 拉取代码到 COMMAND_PATH/.repo/{appId}
306
306
  const repoDir = (0, path_1.join)(utils_1.COMMAND_PATH, '.repo', appId);
307
307
  if ((0, fs_1.existsSync)((0, path_1.join)(repoDir, '.git'))) {
308
- // 已有目录:fetch + 强制切换分支 + pull
308
+ // 已有目录:fetch 目标分支 + 校验远程分支 + 切换 + pull
309
309
  const repoGit = (0, simple_git_1.default)(repoDir);
310
- await repoGit.fetch('origin');
310
+ // 1. 拉取目标分支(显式指定,不受 --single-branch refspec 限制)
311
+ // --prune 确保远程已删除的分支不会残留在本地引用中
312
+ await repoGit.fetch('origin', branch, ['--prune']);
313
+ // 2. 检查远程分支是否存在(远程已删除的分支经 prune 后不会出现在结果中)
311
314
  const remoteBranches = await repoGit.branch(['-r']);
312
315
  if (!remoteBranches.all.includes(`origin/${branch}`)) {
313
316
  utils_1.log.error(`远程分支 origin/${branch} 不存在,请检查仓库 ${repoUrl}`);
314
317
  }
318
+ // 3. 切换分支(本地不存在时 git 自动从 origin/{branch} 创建)
315
319
  await repoGit.checkout(branch, ['-f']);
320
+ // 4. 拉取最新代码
316
321
  await repoGit.pull('origin', branch);
317
322
  }
318
323
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmcb/cli",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "工茂草本前端命令行工具",
5
5
  "author": "yinjiazeng@163.com",
6
6
  "license": "MIT",
@@ -59,5 +59,5 @@
59
59
  "@types/rimraf": "^4.0.5",
60
60
  "@types/user-home": "^2.0.2"
61
61
  },
62
- "gitHead": "7dc381685eea613e6abc5dc1c9cc8f7dd23b045b"
62
+ "gitHead": "5fd97fa0ed7bf5f92d4e64e42ecd96ff0d54faca"
63
63
  }