@gmcb/cli 0.8.3 → 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,22 @@
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
+
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)
15
+
16
+ **Note:** Version bump only for package @gmcb/cli
17
+
18
+
19
+
20
+
21
+
6
22
  ## [0.8.3](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.2...@gmcb/cli@0.8.3) (2026-07-15)
7
23
 
8
24
  **Note:** Version bump only for package @gmcb/cli
@@ -273,10 +273,13 @@ async function fetchRemoteResources(opts) {
273
273
  // 查询版本数据,更新 package.json
274
274
  const appIdPkg = (0, fs_extra_1.readJsonSync)(utils_1.PACKAGE_PATH);
275
275
  const appId = appIdPkg.appId;
276
- const { versionName, versionCode } = await (0, apis_1.fetchLatestVersion)({
276
+ const { versionName, versionCode, updateMode } = await (0, apis_1.fetchLatestVersion)({
277
277
  appId,
278
278
  platform: config_1.CONFIG_DATA.publish?.platform,
279
279
  });
280
+ if (updateMode) {
281
+ config_1.CONFIG_DATA.publish.updateMode = updateMode;
282
+ }
280
283
  if (versionName && versionCode) {
281
284
  let pkgContent = (0, fs_1.readFileSync)(utils_1.PACKAGE_PATH, 'utf-8');
282
285
  pkgContent = pkgContent.replace(/"version"\s*:\s*"[^"]*"/, `"version": "${versionName}"`);
@@ -302,14 +305,19 @@ async function fetchRemoteResources(opts) {
302
305
  // 4. 拉取代码到 COMMAND_PATH/.repo/{appId}
303
306
  const repoDir = (0, path_1.join)(utils_1.COMMAND_PATH, '.repo', appId);
304
307
  if ((0, fs_1.existsSync)((0, path_1.join)(repoDir, '.git'))) {
305
- // 已有目录:fetch + 强制切换分支 + pull
308
+ // 已有目录:fetch 目标分支 + 校验远程分支 + 切换 + pull
306
309
  const repoGit = (0, simple_git_1.default)(repoDir);
307
- await repoGit.fetch('origin');
310
+ // 1. 拉取目标分支(显式指定,不受 --single-branch refspec 限制)
311
+ // --prune 确保远程已删除的分支不会残留在本地引用中
312
+ await repoGit.fetch('origin', branch, ['--prune']);
313
+ // 2. 检查远程分支是否存在(远程已删除的分支经 prune 后不会出现在结果中)
308
314
  const remoteBranches = await repoGit.branch(['-r']);
309
315
  if (!remoteBranches.all.includes(`origin/${branch}`)) {
310
316
  utils_1.log.error(`远程分支 origin/${branch} 不存在,请检查仓库 ${repoUrl}`);
311
317
  }
318
+ // 3. 切换分支(本地不存在时 git 自动从 origin/{branch} 创建)
312
319
  await repoGit.checkout(branch, ['-f']);
320
+ // 4. 拉取最新代码
313
321
  await repoGit.pull('origin', branch);
314
322
  }
315
323
  else {
@@ -127,6 +127,7 @@ export declare function fetchLatestVersion(params: {
127
127
  }): Promise<{
128
128
  versionName: any;
129
129
  versionCode: number;
130
+ updateMode: any;
130
131
  }>;
131
132
  /**
132
133
  * 获取应用信息(自动登录)
package/lib/apis/index.js CHANGED
@@ -220,6 +220,7 @@ async function fetchLatestVersion(params) {
220
220
  return {
221
221
  versionName: latestVersion?.versionName ?? '',
222
222
  versionCode: Number(latestVersion?.versionNum ?? 0),
223
+ updateMode: latestVersion?.updateMode ?? 0,
223
224
  };
224
225
  }
225
226
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmcb/cli",
3
- "version": "0.8.3",
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": "3d53dabaaf579201fb39226ebd8aebdca8082447"
62
+ "gitHead": "5fd97fa0ed7bf5f92d4e64e42ecd96ff0d54faca"
63
63
  }