@aiot-toolkit/emulator 2.0.5-beta.16 → 2.0.5-beta.18

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.
@@ -54,30 +54,30 @@ const systemImageBaseUrl = exports.systemImageBaseUrl = 'https://vela-ide.cnbj3-
54
54
  * vela-dev-0.0.4 : vela 4.0 dev 分支
55
55
  */
56
56
  const VelaImageVersionList = exports.VelaImageVersionList = [{
57
- label: 'vela-miwear-watch-4.0',
58
- description: '原 vela-release-4.0 版本,适用于手表/手环的,带表盘的 vela 4.0 镜像,不可自定义模拟器尺寸',
59
- value: _Vvd.VelaImageType.REL,
60
- time: '20250225',
61
- hide: false,
62
- icon: ''
63
- }, {
64
- label: 'vela-watch-4.0',
65
- description: '原 vela-pre-4.0 版本,适用于手表/手环的,不带表盘的 vela 4.0 镜像,可自定义模拟器尺寸',
66
- value: _Vvd.VelaImageType.PRE,
67
- time: '20250225',
68
- hide: false,
69
- icon: ''
70
- }, {
71
57
  label: 'vela-miwear-watch-5.0',
72
58
  description: '适用于手表/手环的,带表盘的 vela 5.0 镜像,不可自定义模拟器尺寸',
73
59
  value: _Vvd.VelaImageType.VELA_MIWEAR_WATCH_5,
74
- time: '20250225',
60
+ time: '20250605',
75
61
  hide: false,
76
62
  icon: ''
77
63
  }, {
78
64
  label: 'vela-watch-5.0',
79
65
  description: '适用于手表/手环的,不带表盘的 vela 5.0 镜像,可自定义模拟器尺寸',
80
66
  value: _Vvd.VelaImageType.VELA_WATCH_5,
67
+ time: '20250605',
68
+ hide: false,
69
+ icon: ''
70
+ }, {
71
+ label: 'vela-miwear-watch-4.0',
72
+ description: '原 vela-release-4.0 版本,适用于手表/手环的,带表盘的 vela 4.0 镜像,不可自定义模拟器尺寸',
73
+ value: _Vvd.VelaImageType.REL,
74
+ time: '20250526',
75
+ hide: false,
76
+ icon: ''
77
+ }, {
78
+ label: 'vela-watch-4.0',
79
+ description: '原 vela-pre-4.0 版本,适用于手表/手环的,不带表盘的 vela 4.0 镜像,可自定义模拟器尺寸',
80
+ value: _Vvd.VelaImageType.PRE,
81
81
  time: '20250225',
82
82
  hide: false,
83
83
  icon: ''
@@ -86,7 +86,7 @@ const VelaImageVersionList = exports.VelaImageVersionList = [{
86
86
  description: '适用于音响的 vela-miwear 5.0 镜像,不可自定义模拟器尺寸',
87
87
  value: _Vvd.VelaImageType.VELA_MIWEAR_MINISOUND_5,
88
88
  time: '20250318',
89
- hide: false,
89
+ hide: true,
90
90
  icon: ''
91
91
  }];
92
92
  const EmulatorEnvVersion = exports.EmulatorEnvVersion = {
@@ -35,7 +35,7 @@ declare abstract class CommonEmulatorInstance {
35
35
  abstract closeApp(appName: string): Promise<void>;
36
36
  /** 启动应用,留给子类实现 */
37
37
  abstract startApp(packageName: string, debug: boolean): Promise<void>;
38
- /** 推送指定文件 */
38
+ /** 推送指定文件,返回推送结果 */
39
39
  push(sourcePath: string, targetPath: string): Promise<string>;
40
40
  unzip(zipPath: string, targetPath: string): Promise<void>;
41
41
  /** 推送指定 rpk */
@@ -80,14 +80,14 @@ class CommonEmulatorInstance {
80
80
 
81
81
  /** 启动应用,留给子类实现 */
82
82
 
83
- /** 推送指定文件 */
83
+ /** 推送指定文件,返回推送结果 */
84
84
  async push(sourcePath, targetPath) {
85
85
  // 1. adb push应用的rpk
86
86
  const pushCmd = `adb -s ${this.sn} push "${sourcePath}" ${targetPath}`;
87
87
  this.logger(`Excuting: ${pushCmd}`);
88
88
  const res = await adbMiwt.execAdbCmdAsync(pushCmd);
89
89
  this.logger(`Push result: ${res}`);
90
- return targetPath;
90
+ return res;
91
91
  }
92
92
  async unzip(zipPath, targetPath) {
93
93
  const unzipCmd = `adb -s ${this.sn} shell unzip -o ${zipPath} -d ${targetPath}`;
@@ -100,10 +100,7 @@ class CommonEmulatorInstance {
100
100
  async pushRpk(rpkPath, appPackageName) {
101
101
  // 1. adb push应用的rpk
102
102
  const targetPath = `${this.appDir}/${appPackageName}.rpk`;
103
- const pushCmd = `adb -s ${this.sn} push "${rpkPath}" ${targetPath}`;
104
- this.logger(`Excuting: ${pushCmd}`);
105
- const res = await adbMiwt.execAdbCmdAsync(pushCmd);
106
- this.logger(`Push ${this.vvdName} rpk result: ${res}`);
103
+ await this.push(rpkPath, targetPath);
107
104
  return targetPath;
108
105
  }
109
106
 
@@ -5,6 +5,7 @@ import { VelaImageType } from '../typing/Vvd';
5
5
  * 针对 Vela正式版(4.0)的镜像
6
6
  */
7
7
  declare class MiwearInstance extends CommonEmulatorInstance {
8
+ static emulatorStartedFlag: RegExp;
8
9
  static appInstalledFlag: RegExp;
9
10
  imageType: VelaImageType;
10
11
  appDir: string;
@@ -17,6 +17,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
17
17
  * 针对 Vela正式版(4.0)的镜像
18
18
  */
19
19
  class MiwearInstance extends _common.default {
20
+ static emulatorStartedFlag = /quickapp_rpk_installer_init|rpk installer init done/;
20
21
  static appInstalledFlag = /InstallState_Finished|install finished/;
21
22
  imageType = (() => _Vvd.VelaImageType.REL)();
22
23
  appDir = '/data/quickapp/app';
@@ -26,7 +27,9 @@ class MiwearInstance extends _common.default {
26
27
  * @param targeRpk 快应用的rpk文件路径
27
28
  */
28
29
  async install(targeRpk) {
29
- adbMiwt.execAdbCmd(`adb -s ${this.sn} shell pm install ${targeRpk}`);
30
+ const installCmd = `adb -s ${this.sn} shell pm install ${targeRpk}`;
31
+ this.logger(`Excuting: ${installCmd}`);
32
+ adbMiwt.execAdbCmd(installCmd);
30
33
  return new Promise((resolve, reject) => {
31
34
  const func = msg => {
32
35
  if (MiwearInstance.isAppInstalled(msg)) {
@@ -48,6 +51,11 @@ class MiwearInstance extends _common.default {
48
51
  reject('Install timeout');
49
52
  }, 2 * 60 * 1000);
50
53
  this.stdoutReadline.on('line', func);
54
+ this.stdoutReadline.on('close', () => {
55
+ this.stdoutReadline.removeAllListeners();
56
+ clearTimeout(timer);
57
+ reject('Device poweroff');
58
+ });
51
59
  });
52
60
  }
53
61
 
package/lib/vvd/index.js CHANGED
@@ -532,7 +532,11 @@ class VvdManager {
532
532
  (0, _adb.execAdbCmdAsync)(`adb -s emulator-${config['port.serial']} shell poweroff`).then(() => {
533
533
  clearTimeout(t);
534
534
  resolve();
535
- }).catch(() => {
535
+ }).catch(e => {
536
+ if (e?.message?.includes(`device 'emulator-${config['port.serial']}' not found`)) {
537
+ // 清理之前的文件
538
+ _fs.default.unlinkSync(config.path);
539
+ }
536
540
  (0, _utils.killProcessByCmd)(config['avd.name']).then(() => {
537
541
  clearTimeout(t);
538
542
  resolve();
package/lib/vvd/logcat.js CHANGED
@@ -51,6 +51,9 @@ function attachReadline(p, onStdout, onErrout) {
51
51
  });
52
52
  }
53
53
  function dispose() {
54
+ p?.removeAllListeners();
55
+ stdoutReadline?.removeAllListeners();
56
+ stderrReadline?.removeAllListeners();
54
57
  stdoutReadline?.close();
55
58
  stderrReadline?.close();
56
59
  stdoutReadline = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/emulator",
3
- "version": "2.0.5-beta.16",
3
+ "version": "2.0.5-beta.18",
4
4
  "description": "vela emulator tool.",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -36,10 +36,10 @@
36
36
  "emulator"
37
37
  ],
38
38
  "dependencies": {
39
- "@aiot-toolkit/shared-utils": "2.0.5-beta.16",
39
+ "@aiot-toolkit/shared-utils": "2.0.5-beta.18",
40
40
  "@grpc/grpc-js": "^1.13.3",
41
41
  "@grpc/proto-loader": "^0.7.13",
42
- "@miwt/adb": "^0.9.0",
42
+ "@miwt/adb": "0.10.1",
43
43
  "adm-zip": "^0.5.16",
44
44
  "dayjs": "^1.11.12",
45
45
  "find-process": "^1.4.7",
@@ -53,5 +53,5 @@
53
53
  "@types/adm-zip": "^0.5.5",
54
54
  "@types/ini": "^4.1.1"
55
55
  },
56
- "gitHead": "66255b9d69f9b15db10283d662f94f3d1f2486c3"
56
+ "gitHead": "cdcbff776773be9854039419016d04fa11bc7186"
57
57
  }