@deveco-test/deveco-cli 1.3.0-Test.13 → 1.3.0-Test.15
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 +91 -81
- package/SKILL.md +4 -2
- package/dist/cli.js +113 -109
- package/dist/internal/doc-init-background.js +1 -1
- package/docs.zip +0 -0
- package/index.zip +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<a href="https://www.npmjs.com/package/@deveco/deveco-cli"><img src="https://img.shields.io/npm/dm/@deveco/deveco-cli.svg" alt="NPM Downloads" /></a>
|
|
7
7
|
<a href="https://nodejs.org/"><img src="https://img.shields.io/badge/Node.js-%3E%3D18-green.svg" alt="Node.js" /></a>
|
|
8
8
|
<img src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-blue.svg" alt="Platform" />
|
|
9
|
-
<a href="https://developer.huawei.com/consumer/cn/download/"><img src="https://img.shields.io/badge/DevEco%20Studio-%3E%3D6.
|
|
9
|
+
<a href="https://developer.huawei.com/consumer/cn/download/"><img src="https://img.shields.io/badge/DevEco%20Studio-%3E%3D6.0.0-orange.svg" alt="DevEco Studio" /></a>
|
|
10
10
|
<img src="https://img.shields.io/badge/Command%20Line%20Tools-%3E%3D26.0.0-orange.svg" alt="Command Line Tools" />
|
|
11
11
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License" /></a>
|
|
12
12
|
</p>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
- 操作系统为 `macOS` 、 `Windows` 或 `Linux`(需配置对应环境变量)
|
|
23
23
|
- Node.js >= 18,推荐使用22及以上版本
|
|
24
|
-
- [DevEco Studio](https://developer.huawei.com/consumer/cn/download/) >= 6.
|
|
24
|
+
- [DevEco Studio](https://developer.huawei.com/consumer/cn/download/) >= 6.0.0 或 [Command Line Tools](https://developer.huawei.com/consumer/cn/download/) >= 26.0.0
|
|
25
25
|
- **macOS**:必须安装在 `~/Applications` 或 `/Applications` 目录下。
|
|
26
26
|
|
|
27
27
|
### 安装
|
|
@@ -73,7 +73,7 @@ DEVECO_CLI_STUDIO_PATH > DEVECO_CLI_CLT_PATH > Auto_Detect
|
|
|
73
73
|
|
|
74
74
|
| 平台 | DevEco Studio Auto_Detect | Command Line Tools | 最低版本 |
|
|
75
75
|
| ------- | --------------------------------------------- | ------------------ | ----------------------------- |
|
|
76
|
-
| Windows | 支持 | 可选 | Studio `6.
|
|
76
|
+
| Windows | 支持 | 可选 | Studio `6.0.0` / CLT `26.0.0` |
|
|
77
77
|
| macOS | 支持 | 可选 | 同上 |
|
|
78
78
|
| Linux | 不支持 | 必选 | CLT `26.0.0` |
|
|
79
79
|
|
|
@@ -416,6 +416,80 @@ devecocli build --product oversea --modules entry --build-mode release
|
|
|
416
416
|
devecocli build clean
|
|
417
417
|
```
|
|
418
418
|
|
|
419
|
+
### `check compat`
|
|
420
|
+
|
|
421
|
+
基于 `DevEco Studio` 自带的 `apkanalyzer-apiscan` 插件,扫描源代码在两个 `SDK` 版本之间的 `API` 变更情况。
|
|
422
|
+
|
|
423
|
+
**子命令:**
|
|
424
|
+
|
|
425
|
+
| 子命令 | 说明 |
|
|
426
|
+
| --- | --- |
|
|
427
|
+
| `devecocli check compat` | 默认执行工程级扫描 |
|
|
428
|
+
| `devecocli check compat --modules <m1> [m2...]` | 按模块扫描 |
|
|
429
|
+
| `devecocli check compat <file1> [file2...]` | 按文件扫描(仅支持 `.ets`/`.c`/`.cpp`) |
|
|
430
|
+
| `devecocli check compat versions` | 列出可用的目标 `SDK` 版本 |
|
|
431
|
+
|
|
432
|
+
**命令格式:**
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
devecocli check compat [files...] --source-version <ver> --target-version <ver> [--modules <m...>] [--format <default|csv|json>] [--output-path <path>] [--limit <n>]
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
**参数:**
|
|
439
|
+
|
|
440
|
+
| 参数名 | 说明 |
|
|
441
|
+
| --- | --- |
|
|
442
|
+
| `--source-version` | 必填,当前工程 `SDK` 版本 |
|
|
443
|
+
| `--target-version` | 必填,目标 `SDK` 版本 |
|
|
444
|
+
| `--modules` | 可选,指定扫描的模块(多个以空格分隔)。与文件参数互斥 |
|
|
445
|
+
| `--format` | 可选,输出格式。`default`/`csv`/`json`。默认 `default`(控制台输出文本,文件输出 `csv`) |
|
|
446
|
+
| `--output-path` | 可选,报告输出路径。目录或文件(扩展名必须与 `--format` 匹配) |
|
|
447
|
+
| `--limit` | 可选,控制台显示的最大记录数,默认 `100` |
|
|
448
|
+
|
|
449
|
+
**版本号说明:**
|
|
450
|
+
|
|
451
|
+
- 可用版本可通过 `devecocli check compat versions` 查看
|
|
452
|
+
- `zsh` 环境下版本号需用引号包裹(包含括号),例如 `"<source_version>"`、`"<target_version>"`
|
|
453
|
+
|
|
454
|
+
**`compat versions` 参数:**
|
|
455
|
+
|
|
456
|
+
| 参数名 | 说明 |
|
|
457
|
+
| --- | --- |
|
|
458
|
+
| `--format` | 可选,输出格式。`default` 或 `json`。默认 `default`(文本输出,每行一个版本号) |
|
|
459
|
+
|
|
460
|
+
**格式与输出组合:**
|
|
461
|
+
|
|
462
|
+
| 场景 | 允许的 `--format` | 行为 |
|
|
463
|
+
| --- | --- | --- |
|
|
464
|
+
| 控制台输出(无 `--output-path`) | `default` / `json` | `default` 输出文本表格,`json` 输出 `JSON` |
|
|
465
|
+
| 文件输出(`--output-path <file>`,扩展名必须匹配 `--format`) | `default` / `csv` / `json` | `default`/`csv` 写 `.csv` 文件;`json` 写 `.json` 文件 |
|
|
466
|
+
| 目录输出(`--output-path <dir>`,无扩展名) | `default` / `csv` / `json` | `default`/`csv` 生成 `apiChange-res{N}.csv`;`json` 生成 `apiChange-res{N}.json` |
|
|
467
|
+
|
|
468
|
+
**示例:**
|
|
469
|
+
|
|
470
|
+
```bash
|
|
471
|
+
# 工程级扫描,输出到控制台
|
|
472
|
+
devecocli check compat --source-version "<source_version>" --target-version "<target_version>"
|
|
473
|
+
|
|
474
|
+
# 输出 JSON 到控制台
|
|
475
|
+
devecocli check compat --format json --source-version "<source_version>" --target-version "<target_version>"
|
|
476
|
+
|
|
477
|
+
# 输出报告到目录(默认 csv)
|
|
478
|
+
devecocli check compat --output-path ./report --source-version "<source_version>" --target-version "<target_version>"
|
|
479
|
+
|
|
480
|
+
# 输出 JSON 报告到目录(生成 apiChange-res{N}.json)
|
|
481
|
+
devecocli check compat --output-path ./report --format json --source-version "<source_version>" --target-version "<target_version>"
|
|
482
|
+
|
|
483
|
+
# 输出报告到指定文件
|
|
484
|
+
devecocli check compat --output-path ./report.json --format json --source-version "<source_version>" --target-version "<target_version>"
|
|
485
|
+
|
|
486
|
+
# 文件级扫描
|
|
487
|
+
devecocli check compat ./entry/src/main/ets/pages/Index.ets --source-version "<source_version>" --target-version "<target_version>"
|
|
488
|
+
|
|
489
|
+
# 模块级扫描
|
|
490
|
+
devecocli check compat --modules entry har1 --source-version "<source_version>" --target-version "<target_version>"
|
|
491
|
+
```
|
|
492
|
+
|
|
419
493
|
### `check lint`
|
|
420
494
|
|
|
421
495
|
检查代码规范并输出实践建议与报告。
|
|
@@ -435,10 +509,12 @@ devecocli check lint [path]
|
|
|
435
509
|
| `--fix` | 自动修复可修复的问题 |
|
|
436
510
|
| `--incremental` | 仅检查 Git 未提交文件 |
|
|
437
511
|
| `--product <name>` | `build-profile.json5` 中定义的 product,默认为 `default` |
|
|
438
|
-
| `--format <default\|json>` | 完整报告格式;`default` 输出 Markdown,`json` 输出 JSON
|
|
439
|
-
| `--output-path <path>` |
|
|
512
|
+
| `--format <default\|json>` | 完整报告格式;`default` 输出 Markdown,`json` 输出 JSON;要求 DevEco Studio ≥ 6.1.0 |
|
|
513
|
+
| `--output-path <path>` | 完整报告文件或目录,目录形式会自动生成带时间戳的报告文件;要求 DevEco Studio ≥ 6.1.0 |
|
|
440
514
|
| `--limit <number>` | 未指定 `--output-path` 时,限制终端显示的问题数量 |
|
|
441
515
|
|
|
516
|
+
`emulator` 版本要求: DevEco Studio ≥ 6.1.0
|
|
517
|
+
|
|
442
518
|
### `emulator list`
|
|
443
519
|
|
|
444
520
|
查看模拟器实例
|
|
@@ -712,9 +788,15 @@ devecocli emulator license accept
|
|
|
712
788
|
**命令格式:**
|
|
713
789
|
|
|
714
790
|
```bash
|
|
715
|
-
devecocli device list
|
|
791
|
+
devecocli device list [--format <table|json>]
|
|
716
792
|
```
|
|
717
793
|
|
|
794
|
+
**参数:**
|
|
795
|
+
|
|
796
|
+
| 参数名 | 说明 |
|
|
797
|
+
| --- | --- |
|
|
798
|
+
| --format | 可选,输出格式。可选值:`table`、`json`,默认 `table` |
|
|
799
|
+
|
|
718
800
|
### `device view`
|
|
719
801
|
|
|
720
802
|
查询已连接的设备的详细信息,包括设备序列号、设备名称、设备类型、 `OS` 版本等
|
|
@@ -722,7 +804,7 @@ devecocli device list
|
|
|
722
804
|
**命令格式:**
|
|
723
805
|
|
|
724
806
|
```bash
|
|
725
|
-
devecocli device view --target <serialOrName>
|
|
807
|
+
devecocli device view [--target <serialOrName>] [--format <table|json>]
|
|
726
808
|
```
|
|
727
809
|
|
|
728
810
|
**参数:**
|
|
@@ -730,6 +812,7 @@ devecocli device view --target <serialOrName>
|
|
|
730
812
|
| 参数名 | 说明 |
|
|
731
813
|
| ----------- | ------------------------------------- |
|
|
732
814
|
| -t,--target | 可选,目标设备名称或序列号。多设备缺省时,会列出所有已连接设备序列号和名称 |
|
|
815
|
+
| --format | 可选,输出格式。可选值:`table`、`json`,默认 `table` |
|
|
733
816
|
|
|
734
817
|
**示例:**
|
|
735
818
|
|
|
@@ -737,6 +820,7 @@ devecocli device view --target <serialOrName>
|
|
|
737
820
|
devecocli device view
|
|
738
821
|
devecocli device view --target 127.0.0.1:5555
|
|
739
822
|
devecocli device view -t "My Device Name"
|
|
823
|
+
devecocli device view -t 127.0.0.1:5555 --format json
|
|
740
824
|
```
|
|
741
825
|
|
|
742
826
|
### `ui screenshot`
|
|
@@ -1439,80 +1523,6 @@ devecocli signature generate --force
|
|
|
1439
1523
|
devecocli signature generate --help
|
|
1440
1524
|
```
|
|
1441
1525
|
|
|
1442
|
-
### `check compat`
|
|
1443
|
-
|
|
1444
|
-
基于 `DevEco Studio` 自带的 `apkanalyzer-apiscan` 插件,扫描源代码在两个 `SDK` 版本之间的 `API` 变更情况。
|
|
1445
|
-
|
|
1446
|
-
**子命令:**
|
|
1447
|
-
|
|
1448
|
-
| 子命令 | 说明 |
|
|
1449
|
-
| --- | --- |
|
|
1450
|
-
| `devecocli check compat` | 默认执行工程级扫描 |
|
|
1451
|
-
| `devecocli check compat --modules <m1> [m2...]` | 按模块扫描 |
|
|
1452
|
-
| `devecocli check compat <file1> [file2...]` | 按文件扫描(仅支持 `.ets`/`.c`/`.cpp`) |
|
|
1453
|
-
| `devecocli check compat versions` | 列出可用的目标 `SDK` 版本 |
|
|
1454
|
-
|
|
1455
|
-
**命令格式:**
|
|
1456
|
-
|
|
1457
|
-
```bash
|
|
1458
|
-
devecocli check compat [files...] --source-version <ver> --target-version <ver> [--modules <m...>] [--format <default|csv|json>] [--output-path <path>] [--limit <n>]
|
|
1459
|
-
```
|
|
1460
|
-
|
|
1461
|
-
**参数:**
|
|
1462
|
-
|
|
1463
|
-
| 参数名 | 说明 |
|
|
1464
|
-
| --- | --- |
|
|
1465
|
-
| `--source-version` | 必填,当前工程 `SDK` 版本 |
|
|
1466
|
-
| `--target-version` | 必填,目标 `SDK` 版本 |
|
|
1467
|
-
| `--modules` | 可选,指定扫描的模块(多个以空格分隔)。与文件参数互斥 |
|
|
1468
|
-
| `--format` | 可选,输出格式。`default`/`csv`/`json`。默认 `default`(控制台输出文本,文件输出 `csv`) |
|
|
1469
|
-
| `--output-path` | 可选,报告输出路径。目录或文件(扩展名必须与 `--format` 匹配) |
|
|
1470
|
-
| `--limit` | 可选,控制台显示的最大记录数,默认 `100` |
|
|
1471
|
-
|
|
1472
|
-
**版本号说明:**
|
|
1473
|
-
|
|
1474
|
-
- 可用版本可通过 `devecocli check compat versions` 查看
|
|
1475
|
-
- `zsh` 环境下版本号需用引号包裹(包含括号),例如 `"<source_version>"`、`"<target_version>"`
|
|
1476
|
-
|
|
1477
|
-
**`compat versions` 参数:**
|
|
1478
|
-
|
|
1479
|
-
| 参数名 | 说明 |
|
|
1480
|
-
| --- | --- |
|
|
1481
|
-
| `--format` | 可选,输出格式。`default` 或 `json`。默认 `default`(文本输出,每行一个版本号) |
|
|
1482
|
-
|
|
1483
|
-
**格式与输出组合:**
|
|
1484
|
-
|
|
1485
|
-
| 场景 | 允许的 `--format` | 行为 |
|
|
1486
|
-
| --- | --- | --- |
|
|
1487
|
-
| 控制台输出(无 `--output-path`) | `default` / `json` | `default` 输出文本表格,`json` 输出 `JSON` |
|
|
1488
|
-
| 文件输出(`--output-path <file>`,扩展名必须匹配 `--format`) | `default` / `csv` / `json` | `default`/`csv` 写 `.csv` 文件;`json` 写 `.json` 文件 |
|
|
1489
|
-
| 目录输出(`--output-path <dir>`,无扩展名) | `default` / `csv` / `json` | `default`/`csv` 生成 `apiChange-res{N}.csv`;`json` 生成 `apiChange-res{N}.json` |
|
|
1490
|
-
|
|
1491
|
-
**示例:**
|
|
1492
|
-
|
|
1493
|
-
```bash
|
|
1494
|
-
# 工程级扫描,输出到控制台
|
|
1495
|
-
devecocli check compat --source-version "<source_version>" --target-version "<target_version>"
|
|
1496
|
-
|
|
1497
|
-
# 输出 JSON 到控制台
|
|
1498
|
-
devecocli check compat --format json --source-version "<source_version>" --target-version "<target_version>"
|
|
1499
|
-
|
|
1500
|
-
# 输出报告到目录(默认 csv)
|
|
1501
|
-
devecocli check compat --output-path ./report --source-version "<source_version>" --target-version "<target_version>"
|
|
1502
|
-
|
|
1503
|
-
# 输出 JSON 报告到目录(生成 apiChange-res{N}.json)
|
|
1504
|
-
devecocli check compat --output-path ./report --format json --source-version "<source_version>" --target-version "<target_version>"
|
|
1505
|
-
|
|
1506
|
-
# 输出报告到指定文件
|
|
1507
|
-
devecocli check compat --output-path ./report.json --format json --source-version "<source_version>" --target-version "<target_version>"
|
|
1508
|
-
|
|
1509
|
-
# 文件级扫描
|
|
1510
|
-
devecocli check compat ./entry/src/main/ets/pages/Index.ets --source-version "<source_version>" --target-version "<target_version>"
|
|
1511
|
-
|
|
1512
|
-
# 模块级扫描
|
|
1513
|
-
devecocli check compat --modules entry har1 --source-version "<source_version>" --target-version "<target_version>"
|
|
1514
|
-
```
|
|
1515
|
-
|
|
1516
1526
|
## 常见问题
|
|
1517
1527
|
|
|
1518
1528
|
[FAQ](https://gitcode.com/openharmony-sig/deveco-cli/wiki/FAQ.md)
|
package/SKILL.md
CHANGED
|
@@ -33,12 +33,14 @@ Compile and package project/modules. (Defaults: `--product default`, `--build-mo
|
|
|
33
33
|
|
|
34
34
|
### `devecocli check lint`
|
|
35
35
|
Run DevEco Code Linter checks for TS/ArkTS code.
|
|
36
|
+
- **Studio requirement**: Default lint checks and `--fix`, `--incremental`, `--product`, `--config-path`, and `--limit` support DevEco Studio `>= 6.0.0`; explicitly using `--format` or `--output-path` requires DevEco Studio `>= 6.1.0`. Command Line Tools mode follows the CLT `>= 26.0.0` baseline.
|
|
36
37
|
- `[path]`: File or directory to lint. Defaults to the project root from `build-profile.json5`, otherwise the current directory.
|
|
37
38
|
- Options: `--config-path <file>`, `--fix`, `--incremental`, `--product <name>`, `--format <default|json>`, `--output-path <path>`, `--limit <number>`.
|
|
38
39
|
- Set `DEVECO_CLI_CLT_PATH` to the Command Line Tools root when DevEco Studio is not installed; CLT is not discovered automatically from PATH or default installation directories.
|
|
39
40
|
|
|
40
41
|
### `devecocli emulator`
|
|
41
42
|
Manage local emulator instances and system images.
|
|
43
|
+
- **Studio requirement**: DevEco Studio `>= 6.1.0`.
|
|
42
44
|
- `list`: Show instances (status, serial, device type). Opt: `--format <table|json>` (default: `table`).
|
|
43
45
|
- `start <names...>`: Start instances. Quote names with spaces. (See Troubleshooting if blocked).
|
|
44
46
|
- `stop <names...>`: Stop by name or serial (`127.0.0.1:<port>`).
|
|
@@ -69,8 +71,8 @@ Search/read local HarmonyOS docs.
|
|
|
69
71
|
- `catalog`: List available catalogs.
|
|
70
72
|
|
|
71
73
|
### `devecocli device`
|
|
72
|
-
- `list`: Show active real devices and running emulators.
|
|
73
|
-
- `view`: Detailed info. Req `-t <name|serial>` on multi-device hosts.
|
|
74
|
+
- `list`: Show active real devices and running emulators. Opt: `--format <table|json>` (default: `table`).
|
|
75
|
+
- `view`: Detailed info. Req `-t <name|serial>` on multi-device hosts. Opt: `--format <table|json>` (default: `table`).
|
|
74
76
|
|
|
75
77
|
### `devecocli run` `[Outside sandbox]`
|
|
76
78
|
Build, install, and launch.
|