@weapp-tailwindcss/hbuilderx-runner 0.1.1 → 0.1.2

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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @weapp-tailwindcss/hbuilderx-runner
2
2
 
3
- HBuilderX CLI 调用辅助包,用于本地 e2e、demo 脚本和后续 CLI 封装。
3
+ > English | [简体中文](./README.zh-CN.md)
4
+
5
+ Stable HBuilderX CLI runner utilities for local e2e workflows, demo scripts, and future CLI wrappers.
4
6
 
5
7
  ```ts
6
8
  import {
@@ -21,33 +23,32 @@ const launch = hbuilderx.startLaunch({
21
23
  args: ['--deviceId', 'emulator-5554'],
22
24
  })
23
25
 
24
- // 业务侧等待产物或探针后主动停止。
25
26
  await launch.stop()
26
27
  ```
27
28
 
28
- 该包只负责 HBuilderX 调用层稳定性,不处理 Tailwind 或小程序样式转译。
29
+ The package only stabilizes the HBuilderX invocation layer. It does not handle Tailwind or mini program style transformation.
29
30
 
30
- ## 能力边界
31
+ ## Scope
31
32
 
32
- - 同时识别 stable 与 Alpha,可通过 `channel: 'auto' | 'stable' | 'alpha'` 或 `HBUILDERX_CHANNEL` 选择版本。
33
- - 将原生 CLI 路径、`listhost` 返回的 host 和 `version --host` 结果绑定到 runner 会话,避免另一版本的运行进程抢占命令。
34
- - 封装 `project open/close`、`launch`、长驻运行、超时、最近日志与进程树清理。
35
- - 将常见失败归类为可诊断的 `HBuilderXCommandError`,例如项目识别错误、配置加载失败、Android/iOS/Harmony 工具链缺失和命令超时。
36
- - 提供 Android `adb`、iOS Xcode/simulator、Harmony `hdc` 的本地工具链探测函数,供 e2e 或 demo 脚本在运行前快速失败。
33
+ - Resolve stable and Alpha installations through `channel: 'auto' | 'stable' | 'alpha'` or `HBUILDERX_CHANNEL`.
34
+ - Bind the native CLI path, the host returned by `listhost`, and the `version --host` result to one runner session so another running edition cannot capture commands.
35
+ - Wrap `project open/close`, `launch`, long-running processes, timeouts, recent logs, and process-tree cleanup.
36
+ - Classify common failures into `HBuilderXCommandError`, including project recognition failures, config load failures, missing Android/iOS/Harmony toolchains, and timeouts.
37
+ - Provide local Android `adb`, iOS Xcode/simulator, and Harmony `hdc` probes for e2e and demo scripts.
37
38
 
38
- ## 版本选择
39
+ ## Edition selection
39
40
 
40
- 未传配置时使用 `auto`。选择顺序如下:
41
+ The default channel is `auto`. Resolution uses this precedence:
41
42
 
42
- 1. 函数参数中的显式 CLI candidate/path;
43
- 2. `HBUILDERX_CLI_PATH`;
44
- 3. `channel` 或 `HBUILDERX_CHANNEL` 匹配的运行实例;
45
- 4. macOS 默认安装路径,`auto` 下 stable 优先于 Alpha。
43
+ 1. An explicit CLI candidate/path passed to the API;
44
+ 2. `HBUILDERX_CLI_PATH`;
45
+ 3. A running instance matching `channel` or `HBUILDERX_CHANNEL`;
46
+ 4. Default macOS install paths, preferring stable over Alpha in `auto` mode.
46
47
 
47
- macOS 默认路径为 `/Applications/HBuilderX.app/Contents/MacOS/cli` 和 `/Applications/HBuilderX-Alpha.app/Contents/MacOS/cli`。Windows/Linux 的非标准安装请设置 `HBUILDERX_CLI_PATH`。
48
+ The macOS defaults are `/Applications/HBuilderX.app/Contents/MacOS/cli` and `/Applications/HBuilderX-Alpha.app/Contents/MacOS/cli`. Set `HBUILDERX_CLI_PATH` for non-standard Windows/Linux installations.
48
49
 
49
- 当同一 CLI 匹配到多个 host 时,runner 会拒绝猜测。请设置 `HBUILDERX_HOST`,或向 `createHBuilderXRunner` 传入 `host`。
50
+ If one CLI matches multiple hosts, the runner reports an ambiguity instead of guessing. Set `HBUILDERX_HOST` or pass `host` to `createHBuilderXRunner`.
50
51
 
51
- 部分 HBuilderX 版本自身会拒绝 stable 与 Alpha 跨版本并行运行。runner 不会擅自关闭当前实例;目标版本无法启动时会抛出 `cli-instance-mismatch`,请关闭冲突实例后重试。
52
+ Some HBuilderX releases reject concurrent stable and Alpha processes. The runner never closes an existing instance automatically; it reports `cli-instance-mismatch` when the target edition cannot start, so close the conflicting instance before retrying.
52
53
 
53
- `runPnpmCommand`、`spawnPnpmCommand`、`hbuilderxPnpmArgs` 和同步 `startLaunch` 为兼容旧调用保留。需要固定 stable/Alpha 时应使用绑定 runner;`@dcloudio/hbuilderx-cli` 的 pnpm 包装器会重新按运行进程探测版本,无法提供同等保证。
54
+ `runPnpmCommand`, `spawnPnpmCommand`, `hbuilderxPnpmArgs`, and the synchronous `startLaunch` remain for compatibility. Use a bound runner when the stable/Alpha choice must be deterministic; the `@dcloudio/hbuilderx-cli` pnpm wrapper performs its own process discovery and cannot provide that guarantee.
@@ -0,0 +1,55 @@
1
+ # @weapp-tailwindcss/hbuilderx-runner
2
+
3
+ > [English](./README.md) | 简体中文
4
+
5
+ HBuilderX CLI 调用辅助包,用于本地 e2e、demo 脚本和后续 CLI 封装。
6
+
7
+ ```ts
8
+ import {
9
+ createHBuilderXRunner,
10
+ } from '@weapp-tailwindcss/hbuilderx-runner'
11
+
12
+ const hbuilderx = await createHBuilderXRunner({
13
+ channel: 'alpha',
14
+ cwd: projectRoot,
15
+ })
16
+ console.log(hbuilderx.resolution)
17
+
18
+ await hbuilderx.prepareProject({ cwd: projectRoot })
19
+
20
+ const launch = hbuilderx.startLaunch({
21
+ cwd: projectRoot,
22
+ platform: 'app-android',
23
+ args: ['--deviceId', 'emulator-5554'],
24
+ })
25
+
26
+ // 业务侧等待产物或探针后主动停止。
27
+ await launch.stop()
28
+ ```
29
+
30
+ 该包只负责 HBuilderX 调用层稳定性,不处理 Tailwind 或小程序样式转译。
31
+
32
+ ## 能力边界
33
+
34
+ - 同时识别 stable 与 Alpha,可通过 `channel: 'auto' | 'stable' | 'alpha'` 或 `HBUILDERX_CHANNEL` 选择版本。
35
+ - 将原生 CLI 路径、`listhost` 返回的 host 和 `version --host` 结果绑定到 runner 会话,避免另一版本的运行进程抢占命令。
36
+ - 封装 `project open/close`、`launch`、长驻运行、超时、最近日志与进程树清理。
37
+ - 将常见失败归类为可诊断的 `HBuilderXCommandError`,例如项目识别错误、配置加载失败、Android/iOS/Harmony 工具链缺失和命令超时。
38
+ - 提供 Android `adb`、iOS Xcode/simulator、Harmony `hdc` 的本地工具链探测函数,供 e2e 或 demo 脚本在运行前快速失败。
39
+
40
+ ## 版本选择
41
+
42
+ 未传配置时使用 `auto`。选择顺序如下:
43
+
44
+ 1. 函数参数中的显式 CLI candidate/path;
45
+ 2. `HBUILDERX_CLI_PATH`;
46
+ 3. `channel` 或 `HBUILDERX_CHANNEL` 匹配的运行实例;
47
+ 4. macOS 默认安装路径,`auto` 下 stable 优先于 Alpha。
48
+
49
+ macOS 默认路径为 `/Applications/HBuilderX.app/Contents/MacOS/cli` 和 `/Applications/HBuilderX-Alpha.app/Contents/MacOS/cli`。Windows/Linux 的非标准安装请设置 `HBUILDERX_CLI_PATH`。
50
+
51
+ 当同一 CLI 匹配到多个 host 时,runner 会拒绝猜测。请设置 `HBUILDERX_HOST`,或向 `createHBuilderXRunner` 传入 `host`。
52
+
53
+ 部分 HBuilderX 版本自身会拒绝 stable 与 Alpha 跨版本并行运行。runner 不会擅自关闭当前实例;目标版本无法启动时会抛出 `cli-instance-mismatch`,请关闭冲突实例后重试。
54
+
55
+ `runPnpmCommand`、`spawnPnpmCommand`、`hbuilderxPnpmArgs` 和同步 `startLaunch` 为兼容旧调用保留。需要固定 stable/Alpha 时应使用绑定 runner;`@dcloudio/hbuilderx-cli` 的 pnpm 包装器会重新按运行进程探测版本,无法提供同等保证。
package/dist/index.cjs CHANGED
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/hbuilderx-runner",
3
3
  "type": "module",
4
- "version": "0.1.1",
5
- "description": "Stable HBuilderX CLI runner utilities for weapp-tailwindcss local e2e workflows.",
4
+ "version": "0.1.2",
5
+ "description": "HBuilderX runner utilities for cross-platform uni-app Tailwind CSS workflows. 跨端 uni-app Tailwind CSS 工作流的 HBuilderX 运行器工具。",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
8
8
  "repository": {
package/README.en.md DELETED
@@ -1,52 +0,0 @@
1
- # @weapp-tailwindcss/hbuilderx-runner
2
-
3
- Stable HBuilderX CLI runner utilities for local e2e workflows, demo scripts, and future CLI wrappers.
4
-
5
- ```ts
6
- import {
7
- createHBuilderXRunner,
8
- } from '@weapp-tailwindcss/hbuilderx-runner'
9
-
10
- const hbuilderx = await createHBuilderXRunner({
11
- channel: 'alpha',
12
- cwd: projectRoot,
13
- })
14
- console.log(hbuilderx.resolution)
15
-
16
- await hbuilderx.prepareProject({ cwd: projectRoot })
17
-
18
- const launch = hbuilderx.startLaunch({
19
- cwd: projectRoot,
20
- platform: 'app-android',
21
- args: ['--deviceId', 'emulator-5554'],
22
- })
23
-
24
- await launch.stop()
25
- ```
26
-
27
- The package only stabilizes the HBuilderX invocation layer. It does not handle Tailwind or mini program style transformation.
28
-
29
- ## Scope
30
-
31
- - Resolve stable and Alpha installations through `channel: 'auto' | 'stable' | 'alpha'` or `HBUILDERX_CHANNEL`.
32
- - Bind the native CLI path, the host returned by `listhost`, and the `version --host` result to one runner session so another running edition cannot capture commands.
33
- - Wrap `project open/close`, `launch`, long-running processes, timeouts, recent logs, and process-tree cleanup.
34
- - Classify common failures into `HBuilderXCommandError`, including project recognition failures, config load failures, missing Android/iOS/Harmony toolchains, and timeouts.
35
- - Provide local Android `adb`, iOS Xcode/simulator, and Harmony `hdc` probes for e2e and demo scripts.
36
-
37
- ## Edition selection
38
-
39
- The default channel is `auto`. Resolution uses this precedence:
40
-
41
- 1. An explicit CLI candidate/path passed to the API;
42
- 2. `HBUILDERX_CLI_PATH`;
43
- 3. A running instance matching `channel` or `HBUILDERX_CHANNEL`;
44
- 4. Default macOS install paths, preferring stable over Alpha in `auto` mode.
45
-
46
- The macOS defaults are `/Applications/HBuilderX.app/Contents/MacOS/cli` and `/Applications/HBuilderX-Alpha.app/Contents/MacOS/cli`. Set `HBUILDERX_CLI_PATH` for non-standard Windows/Linux installations.
47
-
48
- If one CLI matches multiple hosts, the runner reports an ambiguity instead of guessing. Set `HBUILDERX_HOST` or pass `host` to `createHBuilderXRunner`.
49
-
50
- Some HBuilderX releases reject concurrent stable and Alpha processes. The runner never closes an existing instance automatically; it reports `cli-instance-mismatch` when the target edition cannot start, so close the conflicting instance before retrying.
51
-
52
- `runPnpmCommand`, `spawnPnpmCommand`, `hbuilderxPnpmArgs`, and the synchronous `startLaunch` remain for compatibility. Use a bound runner when the stable/Alpha choice must be deterministic; the `@dcloudio/hbuilderx-cli` pnpm wrapper performs its own process discovery and cannot provide that guarantee.