@gmcb/cli 0.9.12 → 0.9.14

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
@@ -2,6 +2,16 @@
2
2
 
3
3
  <!-- release:insert -->
4
4
 
5
+ ## 0.9.14 [2026-11-16]
6
+ <!-- generated-by: specs -->
7
+ ### 修复
8
+ - 子应用发布 wgt 或 zip 其中一种时,不再用历史版本回填另一种包链接,避免更新检查始终命中历史版本。
9
+
10
+ ## 0.9.13 [2026-11-16]
11
+ <!-- generated-by: specs -->
12
+ ### 优化
13
+ - H5 zip 默认不再包含 appId 目录;仅在 `package.json.appId` 存在时保留该目录,并在压缩包 `manifest.json` 中写入 `appid`,兼容存量环境。
14
+
5
15
  ## 0.9.12 [2026-11-16]
6
16
  <!-- generated-by: specs -->
7
17
  ### 优化
package/README.md CHANGED
@@ -42,6 +42,7 @@ gmcb icon --source logo.png
42
42
  - HBuilderX CLI 路径用 `gmcb config --cli.hbuilderx <path>` 配置。
43
43
  - `uni.build.json` 可配置 wgt 文件名/输出路径与发布参数;App/H5 包名、bundle、appid(`app.android.packagename`、`app.ios.bundle`、`app.harmony.packagename`、`h5.windows.appid`、`h5.macos.appid`)需显式配置,CLI 不再从 `package.json` 的 `appId` 自动补齐。
44
44
  - appId 优先取 `package.json` 的 `appId`,缺失时回退 `manifest.json` 的 `appid`;存量项目无需调整,新项目可删除 `package.json.appId`。
45
+ - H5 zip 默认不包含 appId 目录;仅 `package.json.appId` 存在时保留该目录,zip 内 `manifest.json` 会写入 `appid`。
45
46
  - 项目模板仓库与技能仓库需显式配置(无内置默认值):`gmcb config --template.repo <repo-url>`、`gmcb config --skill.repo <repo-url>`;未配置时 `gmcb create` / `gmcb skill sync` 会提示先添加。
46
47
 
47
48
  ## 文档
@@ -288,6 +288,7 @@ async function getCommands(...args) {
288
288
  }
289
289
  function generateH5Manifest() {
290
290
  const manifest = (0, utils_1.readManifest)();
291
+ const pkg = (0, fs_extra_1.readJsonSync)(utils_1.PACKAGE_PATH, { throws: false }) || {};
291
292
  const source = (0, path_1.join)(utils_1.COMMAND_PATH, utils_1.HAS_SRC ? 'dist/build/h5' : 'unpackage/dist/build/web');
292
293
  if (!(0, fs_1.existsSync)(source)) {
293
294
  utils_1.log.warning('H5 构建输出目录不存在,跳过生成 manifest.json');
@@ -296,6 +297,7 @@ function generateH5Manifest() {
296
297
  (0, fs_extra_1.writeJsonSync)((0, path_1.join)(source, 'manifest.json'), {
297
298
  versionName: manifest['versionName'] || '',
298
299
  versionCode: manifest['versionCode'] || '',
300
+ appid: (0, utils_1.resolveAppId)(manifest, pkg),
299
301
  });
300
302
  }
301
303
  async function generatePackage(opts) {
@@ -332,14 +334,18 @@ async function generatePackage(opts) {
332
334
  defaultSource = 'dist/win-unpacked/resources';
333
335
  }
334
336
  const ext = platform?.startsWith('app') ? '.wgt' : '.zip';
335
- const appId = (0, utils_1.resolveAppId)(manifest, pkg);
336
337
  const name = zipConfig.name || `${manifest.appid || pkg.name}${ext}`;
337
338
  const source = (0, path_1.join)(utils_1.COMMAND_PATH, zipConfig.source || defaultSource);
338
339
  dest = (0, path_1.join)(utils_1.COMMAND_PATH, `${zipConfig.path || 'unpackage/release'}/${name}`);
339
340
  if ((0, fs_1.existsSync)(dest)) {
340
341
  (0, fs_1.unlinkSync)(dest);
341
342
  }
342
- const zipRoot = compiler === 'uni' && platform === 'h5' ? appId : '';
343
+ const zipRoot = compiler === 'uni' && platform === 'h5' && pkg.appId ? String(pkg.appId) : '';
344
+ if (compiler === 'uni' && platform === 'h5') {
345
+ const h5ManifestPath = (0, path_1.join)(source, 'manifest.json');
346
+ const h5Manifest = (0, fs_extra_1.readJsonSync)(h5ManifestPath, { throws: false }) || {};
347
+ (0, fs_extra_1.writeJsonSync)(h5ManifestPath, { ...h5Manifest, appid: (0, utils_1.resolveAppId)(manifest, pkg) });
348
+ }
343
349
  zip.addLocalFolder(source, zipRoot);
344
350
  zip.writeZip(dest);
345
351
  }
package/lib/apis/index.js CHANGED
@@ -190,6 +190,15 @@ async function publishVersion(params) {
190
190
  fallbackFullUrl = '';
191
191
  fallbackResUrl = '';
192
192
  }
193
+ // 子应用允许 wgt/zip 只发一个,禁止用历史版本补齐另一包,
194
+ // 否则新版本链接会指向历史版本文件,客户端更新检查会一直命中历史版本。
195
+ if (publishType == 3) {
196
+ fallbackFullUrl = '';
197
+ fallbackResUrl = '';
198
+ }
199
+ if (publishType == 3 && !fullUrl && !resUrl) {
200
+ throw new Error('子应用发布未上传 wgt 或 zip 文件');
201
+ }
193
202
  await postVersion({
194
203
  id: versionId,
195
204
  fullPackageUrl: fullUrl || fallbackFullUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmcb/cli",
3
- "version": "0.9.12",
3
+ "version": "0.9.14",
4
4
  "description": "工茂草本前端命令行工具",
5
5
  "author": "yinjiazeng@163.com",
6
6
  "license": "UNLICENSED",