@gmcb/cli 0.7.9 → 0.7.11

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.7.11](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.10...@gmcb/cli@0.7.11) (2026-07-13)
7
+
8
+ **Note:** Version bump only for package @gmcb/cli
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.7.10](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.9...@gmcb/cli@0.7.10) (2026-07-12)
15
+
16
+ **Note:** Version bump only for package @gmcb/cli
17
+
18
+
19
+
20
+
21
+
6
22
  ## [0.7.9](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.7...@gmcb/cli@0.7.9) (2026-07-12)
7
23
 
8
24
  **Note:** Version bump only for package @gmcb/cli
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 aniu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -34,6 +34,7 @@ npm i @gmcb/cli -g
34
34
  | `--wgt` | 构建移动应用热更新资源 |
35
35
  | `--zip` | 构建桌面应用热更新资源 |
36
36
  | `--apk` | 构建 Android 应用 |
37
+ | `--nobuild` | 跳过构建步骤,仅执行后续流程(打包、远程资源拉取等) |
37
38
 
38
39
  使用 `--wgt` 构建移动应用热更新资源时,会先通过 vite/uni 正常构建 app,再将构建产物(`dist/build/app` 或 `unpackage/dist/build/app-plus`)打包为 `.wgt` 文件,输出路径默认为 `unpackage/release`。
39
40
 
@@ -72,6 +73,7 @@ gmcb build -p app --wgt
72
73
  | `--zip` | 构建桌面应用热更新资源 |
73
74
  | `--apk` | 构建 Android 应用 |
74
75
  | `-a, --auto` | 自动发布,跳过所有确认提示 |
76
+ | `--nobuild` | 跳过构建步骤,仅执行后续流程(打包、远程资源拉取等) |
75
77
 
76
78
  示例:
77
79
 
@@ -269,14 +269,14 @@ function downloadFile(url, dest) {
269
269
  });
270
270
  }
271
271
  async function fetchRemoteResources(opts) {
272
- const spinner = (0, ora_1.default)(`正在拉取远程资源...`).start();
272
+ const spinner = (0, ora_1.default)(`正在拉取远程仓库...`).start();
273
273
  const pkg = (0, fs_extra_1.readJsonSync)(utils_1.PACKAGE_PATH);
274
274
  // 校验 version 和 versionCode 必须存在
275
275
  if (!pkg.version) {
276
- throw new Error('package.json 缺少 version 字段');
276
+ utils_1.log.error('package.json 缺少 version 字段');
277
277
  }
278
278
  if (!pkg.versionCode) {
279
- throw new Error('package.json 缺少 versionCode 字段');
279
+ utils_1.log.error('package.json 缺少 versionCode 字段');
280
280
  }
281
281
  const appId = pkg.appId;
282
282
  // 1. 获取应用信息
@@ -295,7 +295,7 @@ async function fetchRemoteResources(opts) {
295
295
  await repoGit.fetch('origin');
296
296
  const remoteBranches = await repoGit.branch(['-r']);
297
297
  if (!remoteBranches.all.includes(`origin/${branch}`)) {
298
- throw new Error(`远程分支 origin/${branch} 不存在,请检查仓库 ${repoUrl}`);
298
+ utils_1.log.error(`远程分支 origin/${branch} 不存在,请检查仓库 ${repoUrl}`);
299
299
  }
300
300
  await repoGit.checkout(branch, ['-f']);
301
301
  await repoGit.pull('origin', branch);
@@ -308,7 +308,7 @@ async function fetchRemoteResources(opts) {
308
308
  await cloneGit.clone(repoUrl, repoDir, ['--branch', branch, '--single-branch']);
309
309
  }
310
310
  catch (err) {
311
- throw new Error(`远程仓库或分支 ${branch} 不存在:${repoUrl}`);
311
+ utils_1.log.error(err.message);
312
312
  }
313
313
  }
314
314
  spinner.stop();
@@ -396,19 +396,21 @@ async function fetchRemoteResources(opts) {
396
396
  async function default_1(...args) {
397
397
  const opts = args[0];
398
398
  const commands = await getCommands(...args);
399
- if (opts.remote && ['electron-vite', 'gradlew'].includes(opts.compiler)) {
400
- await fetchRemoteResources(opts);
401
- }
402
399
  const command = commands.join(' ');
403
- const time = Date.now();
404
- (0, utils_1.spawnSync)(command);
400
+ if (!opts.nobuild) {
401
+ const time = Date.now();
402
+ (0, utils_1.spawnSync)(command);
403
+ if ((Date.now() - time) / 1000 <= 1) {
404
+ if (command.includes(config_1.CONFIG_DATA.cli.hbuilderx)) {
405
+ utils_1.log.error('检测到您的HbuilderX未启动或项目管理器中未发现构建项目,请检查后重试!');
406
+ }
407
+ }
408
+ }
405
409
  if ((0, fs_1.existsSync)(envPath)) {
406
410
  (0, fs_1.unlinkSync)(envPath);
407
411
  }
408
- if ((Date.now() - time) / 1000 <= 1) {
409
- if (command.includes(config_1.CONFIG_DATA.cli.hbuilderx)) {
410
- utils_1.log.error('检测到您的HbuilderX未启动或项目管理器中未发现构建项目,请检查后重试!');
411
- }
412
+ if (opts.remote && ['electron-vite', 'gradlew'].includes(opts.compiler)) {
413
+ await fetchRemoteResources(opts);
412
414
  }
413
415
  // H5 构建完成后立即生成 manifest.json
414
416
  if (opts.compiler === 'uni' && opts.platform === 'h5') {
package/lib/apis/index.js CHANGED
@@ -16,6 +16,7 @@ exports.getAppInfo = getAppInfo;
16
16
  const http_1 = require("./http");
17
17
  const const_1 = require("../utils/const");
18
18
  const config_1 = require("../utils/config");
19
+ const utils_1 = require("../utils");
19
20
  /**
20
21
  * 登录
21
22
  */
@@ -149,7 +150,7 @@ async function publishVersion(params) {
149
150
  latest = (Array.isArray(historyData) ? historyData : historyData?.list)?.[0];
150
151
  }
151
152
  if (!existingVersion && latest && Number(versionCode) <= Number(latest.versionNum)) {
152
- throw new Error(`版本号不能小于上次发布 ${latest.versionNum}`);
153
+ utils_1.log.error(`版本号不能小于上次发布 ${latest.versionNum}`);
153
154
  }
154
155
  let versionId;
155
156
  if (existingVersion) {
@@ -247,7 +248,7 @@ async function getAppInfo(appId) {
247
248
  const { data: pageData } = await getAppPage({ appId, pageNo: 1, pageSize: 10 });
248
249
  const appData = pageData?.list?.[0];
249
250
  if (!appData)
250
- throw new Error(`未查询到 ${appId} 应用数据`);
251
+ utils_1.log.error(`未查询到 ${appId} 应用数据`);
251
252
  let configJson = {};
252
253
  try {
253
254
  configJson = JSON.parse(appData?.configJson || '{}');
package/lib/bin.js CHANGED
@@ -51,6 +51,7 @@ program
51
51
  .option(...commands_1.linux)
52
52
  .option(...commands_1.apk)
53
53
  .option(...commands_1.remote)
54
+ .option(...commands_1.nobuild)
54
55
  .action(build_1.default);
55
56
  program
56
57
  .command('copy')
@@ -80,6 +81,7 @@ program
80
81
  .option(...commands_1.apk)
81
82
  .option(...commands_1.skip)
82
83
  .option(...commands_1.remote)
84
+ .option(...commands_1.nobuild)
83
85
  .action(publish_1.default);
84
86
  program
85
87
  .command('config [name]')
@@ -24,6 +24,7 @@ export declare const res: readonly ["--res", "是否构建移动应用本地资
24
24
  export declare const apk: readonly ["--apk", "是否构建Android应用"];
25
25
  export declare const skip: readonly ["--skip", "跳过所有确认,自动发布"];
26
26
  export declare const remote: readonly ["--remote", "是否从远程拉取资源构建"];
27
+ export declare const nobuild: readonly ["--nobuild", "跳过构建步骤"];
27
28
  export declare const hbuilderxCli: readonly ["--cli.hbuilderx <cli-path>", "HbuilderX Cli路径"];
28
29
  export declare const weixinCli: readonly ["--cli.weixin <cli-path>", "微信开发者工具 Cli路径"];
29
30
  export declare const alipayCli: readonly ["--cli.alipay <cli-path>", "支付宝开发者工具 Cli路径"];
@@ -56,6 +57,7 @@ export interface Options {
56
57
  linux: boolean;
57
58
  apk?: boolean;
58
59
  remote?: boolean;
60
+ nobuild?: boolean;
59
61
  'skill.repo'?: string;
60
62
  'template.repo'?: string;
61
63
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.templateRepo = exports.skillRepo = exports.cosSecretkey = exports.cosSecretid = exports.alipayCli = exports.weixinCli = exports.hbuilderxCli = exports.remote = exports.skip = exports.apk = exports.res = exports.wgt = exports.pack = exports.custom = exports.zip = exports.linux = exports.mac = exports.win = exports.link = exports.path = exports.name = exports.clean = exports.ignore = exports.dest = exports.source = exports.branch = exports.env = exports.compiler = exports.project = exports.platform = exports.template = exports.version = void 0;
3
+ exports.templateRepo = exports.skillRepo = exports.cosSecretkey = exports.cosSecretid = exports.alipayCli = exports.weixinCli = exports.hbuilderxCli = exports.nobuild = exports.remote = exports.skip = exports.apk = exports.res = exports.wgt = exports.pack = exports.custom = exports.zip = exports.linux = exports.mac = exports.win = exports.link = exports.path = exports.name = exports.clean = exports.ignore = exports.dest = exports.source = exports.branch = exports.env = exports.compiler = exports.project = exports.platform = exports.template = exports.version = void 0;
4
4
  exports.version = ['-v, --version', '输出版本号'];
5
5
  exports.template = ['-t, --template <template-name>', '模版仓库名称'];
6
6
  exports.platform = ['-p, --platform <platform-name>', '编译平台,默认h5', 'h5'];
@@ -26,6 +26,7 @@ exports.res = ['--res', '是否构建移动应用本地资源'];
26
26
  exports.apk = ['--apk', '是否构建Android应用'];
27
27
  exports.skip = ['--skip', '跳过所有确认,自动发布'];
28
28
  exports.remote = ['--remote', '是否从远程拉取资源构建'];
29
+ exports.nobuild = ['--nobuild', '跳过构建步骤'];
29
30
  exports.hbuilderxCli = ['--cli.hbuilderx <cli-path>', 'HbuilderX Cli路径'];
30
31
  exports.weixinCli = ['--cli.weixin <cli-path>', '微信开发者工具 Cli路径'];
31
32
  exports.alipayCli = ['--cli.alipay <cli-path>', '支付宝开发者工具 Cli路径'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmcb/cli",
3
- "version": "0.7.9",
3
+ "version": "0.7.11",
4
4
  "description": "工茂草本前端命令行工具",
5
5
  "author": "yinjiazeng@163.com",
6
6
  "license": "MIT",
@@ -58,5 +58,6 @@
58
58
  "@types/inquirer": "^9.0.7",
59
59
  "@types/rimraf": "^4.0.5",
60
60
  "@types/user-home": "^2.0.2"
61
- }
61
+ },
62
+ "gitHead": "7a25dd268c4b0287563f11b1837f63186693bc86"
62
63
  }