@gmcb/cli 0.9.4 → 0.9.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,7 +3,7 @@
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.9.4](http://10.10.10.16/caoben/front-end-tools/compare/@gmcb/cli@0.9.3...@gmcb/cli@0.9.4) (2026-11-04)
6
+ ## [0.9.5](http://10.10.10.16/caoben/front-end-tools/compare/@gmcb/cli@0.9.4...@gmcb/cli@0.9.5) (2026-11-04)
7
7
 
8
8
  **Note:** Version bump only for package @gmcb/cli
9
9
 
@@ -11,17 +11,26 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- ## [0.9.3](http://10.10.10.16/caoben/front-end-tools/compare/@gmcb/cli@0.9.2...@gmcb/cli@0.9.3) (2026-11-04)
15
-
16
-
17
- ### Bug Fixes
18
-
19
- * 合并 CLI 调整(image/config 命令、gradlew 构建流程与 uni-app x 路由) ([4e1734b](http://10.10.10.16/caoben/front-end-tools/commits/4e1734b7ae1ec0c3f2a910c27d9220f1ea7010ec))
20
-
21
-
22
-
23
-
24
-
14
+
15
+ ## [0.9.4](http://10.10.10.16/caoben/front-end-tools/compare/@gmcb/cli@0.9.3...@gmcb/cli@0.9.4) (2026-11-04)
16
+
17
+ **Note:** Version bump only for package @gmcb/cli
18
+
19
+
20
+
21
+
22
+
23
+ ## [0.9.3](http://10.10.10.16/caoben/front-end-tools/compare/@gmcb/cli@0.9.2...@gmcb/cli@0.9.3) (2026-11-04)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * 合并 CLI 调整(image/config 命令、gradlew 构建流程与 uni-app x 路由) ([4e1734b](http://10.10.10.16/caoben/front-end-tools/commits/4e1734b7ae1ec0c3f2a910c27d9220f1ea7010ec))
29
+
30
+
31
+
32
+
33
+
25
34
 
26
35
  ## [0.9.2](http://10.10.10.16/caoben/front-end-tools/compare/@gmcb/cli@0.9.1...@gmcb/cli@0.9.2) (2026-11-02)
27
36
 
@@ -167,11 +167,14 @@ async function getCommands(...args) {
167
167
  if (!(0, fs_1.existsSync)(utils_1.PACKAGE_PATH)) {
168
168
  commands = [];
169
169
  }
170
+ let projectPath = utils_1.COMMAND_PATH;
170
171
  if (projectName !== currentName) {
171
- const sourcePath = opts.source ? (0, path_1.join)(utils_1.COMMAND_PATH, opts.source) : utils_1.COMMAND_PATH;
172
- envPath = (0, path_1.join)(sourcePath, 'buildenv');
172
+ if (opts.source) {
173
+ projectPath = (0, path_1.join)(utils_1.COMMAND_PATH, opts.source);
174
+ }
175
+ envPath = (0, path_1.join)(projectPath, 'buildenv');
173
176
  if (opts.source && opts.branch) {
174
- const git = (0, simple_git_1.default)(sourcePath);
177
+ const git = (0, simple_git_1.default)(projectPath);
175
178
  const branch = await git.branch();
176
179
  if (opts.branch !== branch.current) {
177
180
  utils_1.log.error(`您当前构建分支为“${opts.branch}”,项目“${projectName}”构建分支为“${branch.current}”,分支不一致,无法完成构建,请更改后重试!`);
@@ -256,7 +259,8 @@ async function getCommands(...args) {
256
259
  utils_1.log.error(`不支持的平台:${opts.platform}`);
257
260
  }
258
261
  if (cmds) {
259
- commands = [...commands, config_1.CONFIG_DATA?.cli?.hbuilderx, ...cmds, '--project', projectName];
262
+ // HBuilderX CLI 的 --project 支持绝对路径:统一传工程目录(--source 时为源码工程目录),无需先 project open
263
+ commands = [...commands, config_1.CONFIG_DATA?.cli?.hbuilderx, ...cmds, '--project', projectPath];
260
264
  }
261
265
  }
262
266
  }
@@ -367,31 +371,6 @@ function downloadFile(url, dest) {
367
371
  .on('error', rej);
368
372
  });
369
373
  }
370
- /**
371
- * 调用 HBuilderX CLI 对 .repo 工程执行 project open/close
372
- * - open 用于让 HBuilderX 加载最新的 manifest.json / package.json
373
- * - close 用于构建后释放项目
374
- * 错误在本函数内处理:open 失败提示并退出,close 失败仅告警
375
- */
376
- function runHBuilderXProject(action, repoDir) {
377
- const hbuilderxCli = config_1.CONFIG_DATA?.cli?.hbuilderx;
378
- if (!hbuilderxCli) {
379
- utils_1.log.error('HbuilderX Cli路径不正确,请执行“gmcb config --cli.hbuilderx <cli-path>”设置正确的路径!');
380
- return;
381
- }
382
- try {
383
- (0, child_process_1.execSync)(`"${hbuilderxCli}" project ${action} --path "${repoDir}"`, { cwd: repoDir, stdio: 'inherit' });
384
- }
385
- catch (err) {
386
- const message = err?.message || String(err);
387
- if (action === 'open') {
388
- utils_1.log.error(`打开 HBuilderX 项目失败:${message}`);
389
- }
390
- else {
391
- utils_1.log.warning(`关闭 HBuilderX 项目失败:${message}`);
392
- }
393
- }
394
- }
395
374
  async function pullRemoteResources(opts) {
396
375
  const spinner = (0, ora_1.default)(`正在拉取远程资源...`).start();
397
376
  const pkg = (0, fs_extra_1.readJsonSync)(utils_1.PACKAGE_PATH);
@@ -482,10 +461,7 @@ async function pullRemoteResources(opts) {
482
461
  }
483
462
  }
484
463
  if (opts.compiler === 'gradlew') {
485
- // 构建 App 并拷贝:构建前 open 让 HBuilderX 加载最新工程信息,构建后 close
486
- runHBuilderXProject('open', repoDir);
487
464
  (0, child_process_1.execSync)(`npm run build:android:${buildEnv}`, { cwd: repoDir, stdio: 'inherit' });
488
- runHBuilderXProject('close', repoDir);
489
465
  (0, child_process_1.execSync)('npm run copy:android', { cwd: repoDir, stdio: 'inherit' });
490
466
  // 修改主项目 strings.xml 中的应用名称
491
467
  const stringsPath = (0, path_1.join)(utils_1.COMMAND_PATH, 'app', 'src', 'main', 'res', 'values', 'strings.xml');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmcb/cli",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "工茂草本前端命令行工具",
5
5
  "author": "yinjiazeng@163.com",
6
6
  "license": "MIT",
@@ -58,5 +58,5 @@
58
58
  "@types/rimraf": "^4.0.5",
59
59
  "@types/user-home": "^2.0.2"
60
60
  },
61
- "gitHead": "f08146b438f7da9d13513596ebab9e8c491e809b"
61
+ "gitHead": "9035e1ec3a89eb7d2c864ce0c0280e48759e2d04"
62
62
  }