android-midscene-automation 2.0.0 → 2.0.1

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
@@ -4,14 +4,14 @@
4
4
 
5
5
  项目仓库:[oooooooko/Qualix](https://github.com/oooooooko/Qualix)。
6
6
 
7
- 这个包直接调用 Qualix 的启动入口,保留原命令及其参数:
7
+ 这个包每次启动都会通过 npm 检查并运行 `qualix@latest`,保留原命令及其参数:
8
8
 
9
9
  ```sh
10
10
  npx --yes android-midscene-automation@latest
11
11
  npx --yes android-midscene-automation@latest --port 5174
12
12
  ```
13
13
 
14
- 每次启动时会先提示项目已更名为 Qualix,并建议使用 `npx --yes qualix@latest`,随后继续正常启动。提示写入标准错误输出,不影响标准输出和命令退出码。
14
+ 每次启动时会先提示项目已更名为 Qualix,并建议使用 `npx --yes qualix@latest`,随后检查并启动最新版。提示写入标准错误输出,不影响标准输出和命令退出码。
15
15
 
16
16
  新用户也可以使用:
17
17
 
@@ -19,8 +19,10 @@ npx --yes android-midscene-automation@latest --port 5174
19
19
  npx --yes qualix@latest
20
20
  ```
21
21
 
22
- 兼容包依赖 Qualix `^2.0.0`,安装时按此版本范围解析依赖。要始终明确请求 Qualix 最新版本,请使用新命令。
22
+ 从兼容包 `2.0.1` 起,不再固定依赖 Qualix 的某个版本范围。每次启动均联网检查 npm 仓库的 `latest`,包括主版本升级;忽略本地的离线优先设置,已下载且仍为最新版的包可继续复用缓存。检查或下载失败时会报错退出,请恢复网络后重试。
23
23
 
24
24
  两种入口使用相同的数据目录与环境变量,已有脚本和配置无需迁移。
25
25
 
26
- 维护者应先在项目根目录发布 `qualix`,再发布此目录中的兼容包。首次发布完成后,上述命令才可从 npm 获取对应的新包。
26
+ 维护者应先发布可用的 `qualix@latest`,再发布此目录中的兼容包 `2.0.1`。此后只需发布 Qualix 新版并更新其 `latest` 标签,无需为每次 Qualix 升级重新发布兼容包。
27
+
28
+ 首次升级兼容包时,若 npm 仍复用旧版缓存,可运行一次 `npx --yes --prefer-online --prefer-offline=false android-midscene-automation@latest`;之后继续使用原命令即可。
@@ -1,3 +1,22 @@
1
1
  #!/usr/bin/env node
2
- console.warn('\n[Qualix] android-midscene-automation 已更名为 Qualix。\n建议今后使用:npx --yes qualix@latest\n本次将继续通过兼容入口正常启动。\n');
3
- await import('qualix/bin/qualix.js');
2
+ import { spawn } from 'node:child_process';
3
+ import { dirname, join } from 'node:path';
4
+
5
+ console.warn('\n[Qualix] android-midscene-automation 已更名为 Qualix。\n建议今后使用:npx --yes qualix@latest\n正在检查并启动 Qualix 最新版…\n');
6
+
7
+ const npmCli = process.env.npm_execpath || (process.platform === 'win32'
8
+ ? join(dirname(process.execPath), 'node_modules/npm/bin/npm-cli.js') : undefined);
9
+ const child = spawn(npmCli ? process.execPath : 'npm', [
10
+ ...(npmCli ? [npmCli] : []),
11
+ 'exec', '--yes', '--prefer-online', '--prefer-offline=false', '--offline=false',
12
+ '--', 'qualix@latest', ...process.argv.slice(2),
13
+ ], { stdio: 'inherit' });
14
+
15
+ child.on('error', error => {
16
+ console.error(`[Qualix] 无法启动最新版:${error.message}`);
17
+ process.exitCode = 1;
18
+ });
19
+ child.on('exit', (code, signal) => {
20
+ if (signal) process.kill(process.pid, signal);
21
+ else process.exitCode = code ?? 1;
22
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "android-midscene-automation",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Qualix 的旧命令兼容入口,保留原有 npx 启动方式。",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,8 +13,5 @@
13
13
  },
14
14
  "files": [
15
15
  "bin"
16
- ],
17
- "dependencies": {
18
- "qualix": "^2.0.0"
19
- }
16
+ ]
20
17
  }