@react-native-harness/platform-vega 1.0.0-alpha.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.
- package/LICENSE +20 -0
- package/README.md +84 -0
- package/dist/config.d.ts +55 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +23 -0
- package/dist/factory.d.ts +5 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +38 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/kepler.d.ts +37 -0
- package/dist/kepler.d.ts.map +1 -0
- package/dist/kepler.js +158 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/eslint.config.mjs +19 -0
- package/package.json +25 -0
- package/src/config.ts +39 -0
- package/src/factory.ts +52 -0
- package/src/index.ts +2 -0
- package/src/kepler.ts +193 -0
- package/tsconfig.json +16 -0
- package/tsconfig.lib.json +21 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Callstack
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
[![mit licence][license-badge]][license]
|
|
4
|
+
[![npm downloads][npm-downloads-badge]][npm-downloads]
|
|
5
|
+
[![Chat][chat-badge]][chat]
|
|
6
|
+
[![PRs Welcome][prs-welcome-badge]][prs-welcome]
|
|
7
|
+
|
|
8
|
+
Vega platform for React Native Harness - enables testing on Vega TV devices and emulators.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @react-native-harness/platform-vega
|
|
14
|
+
# or
|
|
15
|
+
pnpm add @react-native-harness/platform-vega
|
|
16
|
+
# or
|
|
17
|
+
yarn add @react-native-harness/platform-vega
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Import the Vega platform functions in your `rn-harness.config.mjs`:
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
import {
|
|
26
|
+
vegaPlatform,
|
|
27
|
+
vegaEmulator,
|
|
28
|
+
} from '@react-native-harness/platform-vega';
|
|
29
|
+
|
|
30
|
+
const config = {
|
|
31
|
+
runners: [
|
|
32
|
+
vegaPlatform({
|
|
33
|
+
name: 'vega',
|
|
34
|
+
device: vegaEmulator('VegaTV_1'),
|
|
35
|
+
bundleId: 'com.your.app',
|
|
36
|
+
}),
|
|
37
|
+
],
|
|
38
|
+
// ... other config
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default config;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## API
|
|
45
|
+
|
|
46
|
+
### `vegaPlatform(config)`
|
|
47
|
+
|
|
48
|
+
Creates a Vega platform runner configuration.
|
|
49
|
+
|
|
50
|
+
**Parameters:**
|
|
51
|
+
|
|
52
|
+
- `config.name` - Unique name for the runner
|
|
53
|
+
- `config.device` - Vega device configuration (emulator)
|
|
54
|
+
- `config.bundleId` - Vega application bundle ID
|
|
55
|
+
|
|
56
|
+
### `vegaEmulator(deviceName)`
|
|
57
|
+
|
|
58
|
+
Creates a Vega emulator device configuration.
|
|
59
|
+
|
|
60
|
+
**Parameters:**
|
|
61
|
+
|
|
62
|
+
- `deviceName` - Name of the Vega emulator (e.g., 'VegaTV_1')
|
|
63
|
+
|
|
64
|
+
## Requirements
|
|
65
|
+
|
|
66
|
+
- Vega SDK installed
|
|
67
|
+
- Vega emulator running
|
|
68
|
+
- React Native project configured for Vega platform
|
|
69
|
+
|
|
70
|
+
## Made with ❤️ at Callstack
|
|
71
|
+
|
|
72
|
+
`react-native-harness` is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Callstack][callstack-readme-with-love] is a group of React and React Native geeks, contact us at [hello@callstack.com](mailto:hello@callstack.com) if you need any help with these or just want to say hi!
|
|
73
|
+
|
|
74
|
+
Like the project? ⚛️ [Join the team](https://callstack.com/careers/?utm_campaign=Senior_RN&utm_source=github&utm_medium=readme) who does amazing stuff for clients and drives React Native Open Source! 🔥
|
|
75
|
+
|
|
76
|
+
[callstack-readme-with-love]: https://callstack.com/?utm_source=github.com&utm_medium=referral&utm_campaign=react-native-harness&utm_term=readme-with-love
|
|
77
|
+
[license-badge]: https://img.shields.io/npm/l/react-native-harness?style=for-the-badge
|
|
78
|
+
[license]: https://github.com/callstackincubator/react-native-harness/blob/main/LICENSE
|
|
79
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dm/react-native-harness?style=for-the-badge
|
|
80
|
+
[npm-downloads]: https://www.npmjs.com/package/react-native-harness
|
|
81
|
+
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
|
|
82
|
+
[prs-welcome]: ./CONTRIBUTING.md
|
|
83
|
+
[chat-badge]: https://img.shields.io/discord/426714625279524876.svg?style=for-the-badge
|
|
84
|
+
[chat]: https://discord.gg/xgGt7KAjxv
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const VegaEmulatorSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"emulator">;
|
|
4
|
+
deviceId: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
type: "emulator";
|
|
7
|
+
deviceId: string;
|
|
8
|
+
}, {
|
|
9
|
+
type: "emulator";
|
|
10
|
+
deviceId: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const VegaDeviceSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
13
|
+
type: z.ZodLiteral<"emulator">;
|
|
14
|
+
deviceId: z.ZodString;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
type: "emulator";
|
|
17
|
+
deviceId: string;
|
|
18
|
+
}, {
|
|
19
|
+
type: "emulator";
|
|
20
|
+
deviceId: string;
|
|
21
|
+
}>]>;
|
|
22
|
+
export declare const VegaPlatformConfigSchema: z.ZodObject<{
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
device: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
25
|
+
type: z.ZodLiteral<"emulator">;
|
|
26
|
+
deviceId: z.ZodString;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
type: "emulator";
|
|
29
|
+
deviceId: string;
|
|
30
|
+
}, {
|
|
31
|
+
type: "emulator";
|
|
32
|
+
deviceId: string;
|
|
33
|
+
}>]>;
|
|
34
|
+
bundleId: z.ZodString;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
name: string;
|
|
37
|
+
device: {
|
|
38
|
+
type: "emulator";
|
|
39
|
+
deviceId: string;
|
|
40
|
+
};
|
|
41
|
+
bundleId: string;
|
|
42
|
+
}, {
|
|
43
|
+
name: string;
|
|
44
|
+
device: {
|
|
45
|
+
type: "emulator";
|
|
46
|
+
deviceId: string;
|
|
47
|
+
};
|
|
48
|
+
bundleId: string;
|
|
49
|
+
}>;
|
|
50
|
+
export type VegaEmulator = z.infer<typeof VegaEmulatorSchema>;
|
|
51
|
+
export type VegaDevice = z.infer<typeof VegaDeviceSchema>;
|
|
52
|
+
export type VegaPlatformConfig = z.infer<typeof VegaPlatformConfigSchema>;
|
|
53
|
+
export declare const isVegaDeviceEmulator: (device: VegaDevice) => device is VegaEmulator;
|
|
54
|
+
export declare function assertVegaDeviceEmulator(device: VegaDevice): asserts device is VegaEmulator;
|
|
55
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB;;;;;;;;;EAQ7B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;IAE3B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAInC,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,UAAU,KACjB,MAAM,IAAI,YAEZ,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,MAAM,IAAI,YAAY,CAIhC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const VegaEmulatorSchema = z.object({
|
|
3
|
+
type: z.literal('emulator'),
|
|
4
|
+
deviceId: z
|
|
5
|
+
.string()
|
|
6
|
+
.min(1, 'Virtual device instance name is required (e.g., "VegaTV_1", "VegaTV_Debug")'),
|
|
7
|
+
});
|
|
8
|
+
export const VegaDeviceSchema = z.discriminatedUnion('type', [
|
|
9
|
+
VegaEmulatorSchema,
|
|
10
|
+
]);
|
|
11
|
+
export const VegaPlatformConfigSchema = z.object({
|
|
12
|
+
name: z.string().min(1, 'Name is required'),
|
|
13
|
+
device: VegaDeviceSchema,
|
|
14
|
+
bundleId: z.string().min(1, 'Bundle ID is required'),
|
|
15
|
+
});
|
|
16
|
+
export const isVegaDeviceEmulator = (device) => {
|
|
17
|
+
return device.type === 'emulator';
|
|
18
|
+
};
|
|
19
|
+
export function assertVegaDeviceEmulator(device) {
|
|
20
|
+
if (!isVegaDeviceEmulator(device)) {
|
|
21
|
+
throw new Error('Device is not an emulator');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HarnessPlatform } from '@react-native-harness/platforms';
|
|
2
|
+
import { type VegaPlatformConfig, type VegaEmulator } from './config.js';
|
|
3
|
+
export declare const vegaEmulator: (deviceId: string) => VegaEmulator;
|
|
4
|
+
export declare const vegaPlatform: (config: VegaPlatformConfig) => HarnessPlatform;
|
|
5
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AAGrB,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,KAAG,YAG9C,CAAC;AAEH,eAAO,MAAM,YAAY,GAAI,QAAQ,kBAAkB,KAAG,eAkCxD,CAAC"}
|
package/dist/factory.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DeviceNotFoundError, AppNotInstalledError, } from '@react-native-harness/platforms';
|
|
2
|
+
import { VegaPlatformConfigSchema, } from './config.js';
|
|
3
|
+
import * as kepler from './kepler.js';
|
|
4
|
+
export const vegaEmulator = (deviceId) => ({
|
|
5
|
+
type: 'emulator',
|
|
6
|
+
deviceId,
|
|
7
|
+
});
|
|
8
|
+
export const vegaPlatform = (config) => ({
|
|
9
|
+
name: config.name,
|
|
10
|
+
getInstance: async () => {
|
|
11
|
+
const parsedConfig = VegaPlatformConfigSchema.parse(config);
|
|
12
|
+
const deviceId = parsedConfig.device.deviceId;
|
|
13
|
+
const bundleId = parsedConfig.bundleId;
|
|
14
|
+
const deviceStatus = await kepler.getVegaDeviceStatus(deviceId);
|
|
15
|
+
if (deviceStatus === 'stopped') {
|
|
16
|
+
throw new DeviceNotFoundError(deviceId);
|
|
17
|
+
}
|
|
18
|
+
const isInstalled = await kepler.isAppInstalled(deviceId, bundleId);
|
|
19
|
+
if (!isInstalled) {
|
|
20
|
+
throw new AppNotInstalledError(bundleId, deviceId);
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
startApp: async () => {
|
|
24
|
+
await kepler.startApp(deviceId, bundleId);
|
|
25
|
+
},
|
|
26
|
+
restartApp: async () => {
|
|
27
|
+
await kepler.stopApp(deviceId, bundleId);
|
|
28
|
+
await kepler.startApp(deviceId, bundleId);
|
|
29
|
+
},
|
|
30
|
+
stopApp: async () => {
|
|
31
|
+
await kepler.stopApp(deviceId, bundleId);
|
|
32
|
+
},
|
|
33
|
+
dispose: async () => {
|
|
34
|
+
await kepler.stopApp(deviceId, bundleId);
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { vegaPlatform, vegaEmulator } from './factory.js';
|
package/dist/kepler.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type VegaVirtualDeviceStatus = 'running' | 'stopped';
|
|
2
|
+
/**
|
|
3
|
+
* List all available Vega virtual devices
|
|
4
|
+
* Returns array of device identifiers that can be used with kepler commands
|
|
5
|
+
*/
|
|
6
|
+
export declare const listVegaDevices: () => Promise<string[]>;
|
|
7
|
+
/**
|
|
8
|
+
* Check if a specific Vega virtual device is connected/available
|
|
9
|
+
*/
|
|
10
|
+
export declare const isVegaDeviceConnected: (deviceId: string) => Promise<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* Launch an already installed app on specified Vega virtual device
|
|
13
|
+
*/
|
|
14
|
+
export declare const startApp: (deviceId: string, bundleId: string) => Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Check if an app is installed on the specified Vega virtual device
|
|
17
|
+
*/
|
|
18
|
+
export declare const isAppInstalled: (deviceId: string, bundleId: string) => Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* Check if an app is currently running on the specified Vega virtual device
|
|
21
|
+
*/
|
|
22
|
+
export declare const isAppRunning: (deviceId: string, bundleId: string) => Promise<boolean>;
|
|
23
|
+
export declare const stopApp: (deviceId: string, bundleId: string) => Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Start port forwarding for debugging on specified Vega virtual device
|
|
26
|
+
*/
|
|
27
|
+
export declare const startPortForwarding: (deviceId: string, port: number, forward?: boolean) => Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Stop port forwarding on specified Vega virtual device
|
|
30
|
+
*/
|
|
31
|
+
export declare const stopPortForwarding: (deviceId: string, port: number, forward?: boolean) => Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Get status of a specific Vega virtual device
|
|
34
|
+
* Note: Vega CLI might manage virtual devices globally, so this checks if the device is available
|
|
35
|
+
*/
|
|
36
|
+
export declare const getVegaDeviceStatus: (deviceId: string) => Promise<VegaVirtualDeviceStatus>;
|
|
37
|
+
//# sourceMappingURL=kepler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kepler.d.ts","sourceRoot":"","sources":["../src/kepler.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAa,OAAO,CAAC,MAAM,EAAE,CAwBxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAChC,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CAYjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,GACnB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,OAAO,CAAC,IAAI,CASd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CAcjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CAcjB,CAAC;AAEF,eAAO,MAAM,OAAO,GAClB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,OAAO,CAAC,IAAI,CASd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,EAChB,MAAM,MAAM,EACZ,iBAAc,KACb,OAAO,CAAC,IAAI,CAWd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,MAAM,EAChB,MAAM,MAAM,EACZ,iBAAc,KACb,OAAO,CAAC,IAAI,CAWd,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,KACf,OAAO,CAAC,uBAAuB,CAkBjC,CAAC"}
|
package/dist/kepler.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { spawn } from '@react-native-harness/tools';
|
|
2
|
+
/**
|
|
3
|
+
* List all available Vega virtual devices
|
|
4
|
+
* Returns array of device identifiers that can be used with kepler commands
|
|
5
|
+
*/
|
|
6
|
+
export const listVegaDevices = async () => {
|
|
7
|
+
try {
|
|
8
|
+
const { stdout } = await spawn('kepler', ['device', 'list']);
|
|
9
|
+
const lines = stdout.trim().split('\n');
|
|
10
|
+
const devices = [];
|
|
11
|
+
for (const line of lines) {
|
|
12
|
+
if (line.trim()) {
|
|
13
|
+
// Parse device line format: "VirtualDevice : tv - x86_64 - OS - hostname"
|
|
14
|
+
// or potentially "VegaTV_1 : tv - x86_64 - OS - hostname" for named instances
|
|
15
|
+
const deviceId = line.split(' : ')[0].trim();
|
|
16
|
+
if (deviceId &&
|
|
17
|
+
(deviceId === 'VirtualDevice' || deviceId.startsWith('Vega'))) {
|
|
18
|
+
devices.push(deviceId);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return devices;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Check if a specific Vega virtual device is connected/available
|
|
30
|
+
*/
|
|
31
|
+
export const isVegaDeviceConnected = async (deviceId) => {
|
|
32
|
+
try {
|
|
33
|
+
const { stdout } = await spawn('kepler', [
|
|
34
|
+
'device',
|
|
35
|
+
'is-connected',
|
|
36
|
+
'--device',
|
|
37
|
+
deviceId,
|
|
38
|
+
]);
|
|
39
|
+
return stdout.includes('is connected');
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Launch an already installed app on specified Vega virtual device
|
|
47
|
+
*/
|
|
48
|
+
export const startApp = async (deviceId, bundleId) => {
|
|
49
|
+
await spawn('kepler', [
|
|
50
|
+
'device',
|
|
51
|
+
'launch-app',
|
|
52
|
+
'--device',
|
|
53
|
+
deviceId,
|
|
54
|
+
'--appName',
|
|
55
|
+
bundleId,
|
|
56
|
+
]);
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Check if an app is installed on the specified Vega virtual device
|
|
60
|
+
*/
|
|
61
|
+
export const isAppInstalled = async (deviceId, bundleId) => {
|
|
62
|
+
try {
|
|
63
|
+
await spawn('kepler', [
|
|
64
|
+
'device',
|
|
65
|
+
'is-app-installed',
|
|
66
|
+
'--device',
|
|
67
|
+
deviceId,
|
|
68
|
+
'--appName',
|
|
69
|
+
bundleId,
|
|
70
|
+
]);
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Check if an app is currently running on the specified Vega virtual device
|
|
79
|
+
*/
|
|
80
|
+
export const isAppRunning = async (deviceId, bundleId) => {
|
|
81
|
+
try {
|
|
82
|
+
await spawn('kepler', [
|
|
83
|
+
'device',
|
|
84
|
+
'is-app-running',
|
|
85
|
+
'--device',
|
|
86
|
+
deviceId,
|
|
87
|
+
'--appName',
|
|
88
|
+
bundleId,
|
|
89
|
+
]);
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
export const stopApp = async (deviceId, bundleId) => {
|
|
97
|
+
await spawn('kepler', [
|
|
98
|
+
'device',
|
|
99
|
+
'terminate-app',
|
|
100
|
+
'--device',
|
|
101
|
+
deviceId,
|
|
102
|
+
'--appName',
|
|
103
|
+
bundleId,
|
|
104
|
+
]);
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Start port forwarding for debugging on specified Vega virtual device
|
|
108
|
+
*/
|
|
109
|
+
export const startPortForwarding = async (deviceId, port, forward = true) => {
|
|
110
|
+
await spawn('kepler', [
|
|
111
|
+
'device',
|
|
112
|
+
'start-port-forwarding',
|
|
113
|
+
'--device',
|
|
114
|
+
deviceId,
|
|
115
|
+
'--port',
|
|
116
|
+
port.toString(),
|
|
117
|
+
'--forward',
|
|
118
|
+
forward.toString(),
|
|
119
|
+
]);
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Stop port forwarding on specified Vega virtual device
|
|
123
|
+
*/
|
|
124
|
+
export const stopPortForwarding = async (deviceId, port, forward = true) => {
|
|
125
|
+
await spawn('kepler', [
|
|
126
|
+
'device',
|
|
127
|
+
'stop-port-forwarding',
|
|
128
|
+
'--device',
|
|
129
|
+
deviceId,
|
|
130
|
+
'--port',
|
|
131
|
+
port.toString(),
|
|
132
|
+
'--forward',
|
|
133
|
+
forward.toString(),
|
|
134
|
+
]);
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Get status of a specific Vega virtual device
|
|
138
|
+
* Note: Vega CLI might manage virtual devices globally, so this checks if the device is available
|
|
139
|
+
*/
|
|
140
|
+
export const getVegaDeviceStatus = async (deviceId) => {
|
|
141
|
+
try {
|
|
142
|
+
// First check if the device is connected/available
|
|
143
|
+
const isConnected = await isVegaDeviceConnected(deviceId);
|
|
144
|
+
if (isConnected) {
|
|
145
|
+
return 'running';
|
|
146
|
+
}
|
|
147
|
+
// Check general virtual device status
|
|
148
|
+
const { stdout } = await spawn('kepler', ['virtual-device', 'status']);
|
|
149
|
+
// Parse the status output to determine if VVD is running
|
|
150
|
+
return stdout.toLowerCase().includes('running') ||
|
|
151
|
+
stdout.toLowerCase().includes('ready')
|
|
152
|
+
? 'running'
|
|
153
|
+
: 'stopped';
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return 'stopped';
|
|
157
|
+
}
|
|
158
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/tslib/tslib.d.ts","../../../node_modules/tslib/modules/index.d.ts","../../../node_modules/zod/dist/types/v3/helpers/typealiases.d.ts","../../../node_modules/zod/dist/types/v3/helpers/util.d.ts","../../../node_modules/zod/dist/types/v3/zoderror.d.ts","../../../node_modules/zod/dist/types/v3/locales/en.d.ts","../../../node_modules/zod/dist/types/v3/errors.d.ts","../../../node_modules/zod/dist/types/v3/helpers/parseutil.d.ts","../../../node_modules/zod/dist/types/v3/helpers/enumutil.d.ts","../../../node_modules/zod/dist/types/v3/helpers/errorutil.d.ts","../../../node_modules/zod/dist/types/v3/helpers/partialutil.d.ts","../../../node_modules/zod/dist/types/v3/standard-schema.d.ts","../../../node_modules/zod/dist/types/v3/types.d.ts","../../../node_modules/zod/dist/types/v3/external.d.ts","../../../node_modules/zod/dist/types/v3/index.d.ts","../../../node_modules/zod/dist/types/index.d.ts","../src/config.ts","../../platforms/dist/types.d.ts","../../platforms/dist/factory.d.ts","../../platforms/dist/errors.d.ts","../../platforms/dist/index.d.ts","../../tools/dist/abort.d.ts","../../../node_modules/picocolors/types.d.ts","../../../node_modules/picocolors/picocolors.d.ts","../../tools/dist/color.d.ts","../../tools/dist/logger.d.ts","../../../node_modules/@clack/core/dist/index.d.mts","../../../node_modules/@clack/prompts/dist/index.d.mts","../../tools/dist/prompts.d.ts","../../../node_modules/nano-spawn/source/index.d.ts","../../tools/dist/spawn.d.ts","../../tools/dist/react-native.d.ts","../../tools/dist/error.d.ts","../../tools/dist/index.d.ts","../src/kepler.ts","../src/factory.ts","../src/index.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/dom-events.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/index.d.ts"],"fileIdsList":[[127,130,142],[85,130,142],[96,142],[99,142],[100,105,133,142],[101,112,113,120,130,141,142],[101,102,112,120,142],[103,142],[104,105,113,121,142],[105,130,138,142],[106,108,112,120,142],[107,142],[108,109,142],[112,142],[110,112,142],[112,113,114,130,141,142],[112,113,114,127,130,133,142],[142,146],[142],[108,112,115,120,130,141,142],[112,113,115,116,120,130,138,141,142],[115,117,130,138,141,142],[96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148],[112,118,142],[119,141,142],[108,112,120,130,142],[121,142],[122,142],[99,123,142],[124,140,142,146],[125,142],[126,142],[112,127,128,142],[127,129,142,144],[100,112,130,131,132,133,142],[100,130,132,142],[130,131,142],[133,142],[134,142],[112,136,137,142],[136,137,142],[105,120,130,138,142],[139,142],[120,140,142],[100,115,126,141,142],[105,142],[130,142,143],[142,144],[142,145],[100,105,112,114,123,130,141,142,144,146],[130,142,147],[101,142],[81,142],[59,142],[73,142],[63,64,142],[61,62,63,65,66,71,142],[62,63,142],[71,142],[72,142],[63,142],[61,62,63,66,67,68,69,70,142],[61,62,73,142],[60,74,142],[60,75,79,93,142],[60,75,94,142],[60,92,142],[76,142],[76,77,78,142],[82,142],[80,83,84,87,89,90,91,142],[86,142],[88,142]],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6a5253138c5432c68a1510c70fe78a644fe2e632111ba778e1978010d6edfec","impliedFormat":1},{"version":"b8f34dd1757f68e03262b1ca3ddfa668a855b872f8bdd5224d6f993a7b37dc2c","impliedFormat":99},{"version":"d3cfde44f8089768ebb08098c96d01ca260b88bccf238d55eee93f1c620ff5a5","impliedFormat":1},{"version":"293eadad9dead44c6fd1db6de552663c33f215c55a1bfa2802a1bceed88ff0ec","impliedFormat":1},{"version":"54f6ec6ea75acea6eb23635617252d249145edbc7bcd9d53f2d70280d2aef953","impliedFormat":1},{"version":"c25ce98cca43a3bfa885862044be0d59557be4ecd06989b2001a83dcf69620fd","impliedFormat":1},{"version":"8e71e53b02c152a38af6aec45e288cc65bede077b92b9b43b3cb54a37978bb33","impliedFormat":1},{"version":"754a9396b14ca3a4241591afb4edc644b293ccc8a3397f49be4dfd520c08acb3","impliedFormat":1},{"version":"f672c876c1a04a223cf2023b3d91e8a52bb1544c576b81bf64a8fec82be9969c","impliedFormat":1},{"version":"e4b03ddcf8563b1c0aee782a185286ed85a255ce8a30df8453aade2188bbc904","impliedFormat":1},{"version":"de2316e90fc6d379d83002f04ad9698bc1e5285b4d52779778f454dd12ce9f44","impliedFormat":1},{"version":"25b3f581e12ede11e5739f57a86e8668fbc0124f6649506def306cad2c59d262","impliedFormat":1},{"version":"2da997a01a6aa5c5c09de5d28f0f4407b597c5e1aecfd32f1815809c532650a2","impliedFormat":1},{"version":"5d26d2e47e2352def36f89a3e8bf8581da22b7f857e07ef3114cd52cf4813445","impliedFormat":1},{"version":"3db2efd285e7328d8014b54a7fce3f4861ebcdc655df40517092ed0050983617","impliedFormat":1},{"version":"d5d39a24c759df40480a4bfc0daffd364489702fdbcbdfc1711cde34f8739995","impliedFormat":1},{"version":"c60cc243ca6173a51efe04bb22d9bcdfbd7b1cc18e13118e6b90e5c046bd7c10","signature":"d61f315ff00375f03331e6d0196e57cc3cd7a229f7580be3d66867707a20fda6","impliedFormat":99},{"version":"e37270191d6e04dfa60d210394e75002e62398159beec672035a54c9d2827c40","impliedFormat":99},{"version":"fc61bab1427ed7f1e75aaff1d6893859f0ad5832db78e173c7e59abc4b3eebf2","impliedFormat":99},{"version":"742dbfad4257af069a16003c1a48a083697b6fe1c9902ba4a3a54bc08ce8db84","impliedFormat":99},{"version":"6e24348814b735daaa863c787ee558d05db2c9fe90447e97d474ba9f60dfb171","impliedFormat":99},{"version":"3e442c402123b264ccdf7123c1366e1473d9c39f5db69373e938284fc01c49ce","impliedFormat":99},{"version":"590595c1230ebb7c43ebac51b2b2da956a719b213355b4358e2a6b16a8b5936c","impliedFormat":1},{"version":"8c5f0739f00f89f89b03a1fe6658c6d78000d7ebd7f556f0f8d6908fa679de35","impliedFormat":1},{"version":"a15c0df1ac9b2a4d833490522614fc57ae97d70a07bf4964a4d6bb73f3f56399","impliedFormat":99},{"version":"e4cead4a8596a6f051c36ef184f5fb6f117232eefdc1f98ef9847c9efc2c8911","impliedFormat":99},{"version":"df7225806785ade68c6cf2b1cf3ba0d1c7fed1ee7605f34e37d4a901f1d29fd2","impliedFormat":99},{"version":"6bf8a7596880ff1b8f8fd52ee8de8000df00c0c98adacb0b0af0e6a3f16cabe6","impliedFormat":99},{"version":"8af66ec621033f41ccb2bcee775e883c2649fa0db71192fe863185b0281082a6","impliedFormat":99},{"version":"9d4af7bde3e345d3071b5fefbece2d3482971aae89ded50f302c8cb246e81581","impliedFormat":99},{"version":"f3eb748185038bca941a02994b1b0b5803c0a2ce818b8a7d72a24a6b814f5d3e","impliedFormat":99},{"version":"2ba26b5ab00dd3495eeb733cdb46d939a8eb755a395a91169158cdf962aff6c3","impliedFormat":99},{"version":"d6fe58ebff353af75db3986d9ab2b4b57258ad5af3f4b65cdb2100fd47df5425","impliedFormat":99},{"version":"299207f09ec026435d722d979effd6556f7facc6c16256c3c00f797648eed0cb","impliedFormat":99},{"version":"f0bf6855179c3b557232fad4f83a2a8e062bc778793fb9435d6900112c4b05db","signature":"af5c84f9a24b1288b93f068ab296032b6f2001dbb5ede91c90d1c1abaae8e36e","impliedFormat":99},{"version":"fe36630fbf2aa05c4a5739918f1055a4bc501e92ed9024b1cfa5de616d5d19de","signature":"5fdf563cc8c147b1fdde9260253bd48866fbb68224ce26699c22c7a4a7ab4167","impliedFormat":99},{"version":"fe8ca67f4d38f0c30a5eb79ad7732206560849cc8738e059c75ff55c9aa50200","impliedFormat":99},{"version":"7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","impliedFormat":1},{"version":"a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a","impliedFormat":1},{"version":"f749812878fecfa53cfc13b36e5d35086fb6377983a9df44175da83ccc23af1f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7d2e3fea24c712c99c03ad8f556abedbfe105f87f1be10b95dbd409d24bc05a3","impliedFormat":1},{"version":"211e3f15fbced4ab4be19f49ffa990b9ff20d749d33b65ff753be691e7616239","affectsGlobalScope":true,"impliedFormat":1},{"version":"3719525a8f6ab731e3dfd585d9f87df55ec7d50d461df84f74eb4d68bb165244","impliedFormat":1},{"version":"5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713","impliedFormat":1},{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true,"impliedFormat":1},{"version":"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","impliedFormat":1},{"version":"e596c9bb2f29a2699fdd4ae89139612652245192f67f45617c5a4b20832aaae9","impliedFormat":1},{"version":"bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","impliedFormat":1},{"version":"1cdcfc1f624d6c08aa12c73935f6e13f095919cd99edf95752951796eb225729","impliedFormat":1},{"version":"4eaff3d8e10676fd7913d8c108890e71c688e1e7d52f6d1d55c39514f493dc47","impliedFormat":1},{"version":"14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","impliedFormat":1},{"version":"5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea","impliedFormat":1},{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true,"impliedFormat":1},{"version":"00dee7cdca8b8420c47ea4a31a34b8e8294013ebc4f463fd941e867e7bf05029","affectsGlobalScope":true,"impliedFormat":1},{"version":"3256f3cccd578f9e7fe3a28096c505634bebcee8afb738ffa99368e536ca3a0b","impliedFormat":1},{"version":"1c84b46267610a34028edfd0d035509341751262bac1062857f3c8df7aff7153","impliedFormat":1},{"version":"7f138842074d0a40681775af008c8452093b68c383c94de31759e853c6d06b5c","impliedFormat":1},{"version":"a3d541d303ee505053f5dcbf9fafb65cac3d5631037501cd616195863a6c5740","impliedFormat":1},{"version":"8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","impliedFormat":1},{"version":"2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58","impliedFormat":1},{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true,"impliedFormat":1},{"version":"bcebb922784739bdb34c18ee51095d25a92b560c78ccd2eaacd6bd00f7443d83","impliedFormat":1},{"version":"7ee6ed878c4528215c82b664fe0cfe80e8b4da6c0d4cc80869367868774db8b1","impliedFormat":1},{"version":"b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30","impliedFormat":1},{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true,"impliedFormat":1},{"version":"0715e4cd28ad471b2a93f3e552ff51a3ae423417a01a10aa1d3bc7c6b95059d6","affectsGlobalScope":true,"impliedFormat":1},{"version":"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","impliedFormat":1},{"version":"210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","impliedFormat":1},{"version":"36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","impliedFormat":1},{"version":"0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","impliedFormat":1},{"version":"25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","impliedFormat":1},{"version":"4f3fdeba4e28e21aa719c081b8dc8f91d47e12e773389b9d35679c08151c9d37","impliedFormat":1},{"version":"1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","impliedFormat":1},{"version":"69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","impliedFormat":1},{"version":"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","impliedFormat":1},{"version":"23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","impliedFormat":1},{"version":"f69ff39996a61a0dd10f4bce73272b52e8024a4d58b13ab32bf4712909d0a2b7","impliedFormat":1},{"version":"3c4ba1dd9b12ffa284b565063108f2f031d150ea15b8fafbdc17f5d2a07251f3","affectsGlobalScope":true,"impliedFormat":1},{"version":"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","impliedFormat":1},{"version":"1422cd9e705adcc09088fda85a900c2b70e3ad36ea85846f68bd1a884cdf4e2b","impliedFormat":1},{"version":"3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","impliedFormat":1},{"version":"5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2","impliedFormat":1},{"version":"a73ae8c0e62103bb9e21bb6538700881bf135b9a8b125b857ec68edfa0da4ed3","affectsGlobalScope":true,"impliedFormat":1},{"version":"e1c1b2fbe236bf7ee3e342eeae7e20efb8988a0ac7da1cbbfa2c1f66b76c3423","affectsGlobalScope":true,"impliedFormat":1},{"version":"868831cab82b65dfe1d68180e898af1f2101e89ba9b754d1db6fb8cc2fac1921","impliedFormat":1},{"version":"0fe8985a28f82c450a04a6edf1279d7181c0893f37da7d2a27f8efd4fd5edb03","impliedFormat":1},{"version":"e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa","impliedFormat":1},{"version":"52120bb7e4583612225bdf08e7c12559548170f11e660d33a33623bae9bbdbba","affectsGlobalScope":true,"impliedFormat":1},{"version":"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e","impliedFormat":1},{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6dd3dba8e665ac43d279e0fdf5219edda0eed69b5e9a5061f46cd6a65c4f7a1","impliedFormat":1}],"root":[75,[93,95]],"options":{"composite":true,"declarationMap":true,"emitDeclarationOnly":false,"importHelpers":true,"module":199,"noEmitOnError":true,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noImplicitReturns":true,"noUnusedLocals":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":true,"target":9,"tsBuildInfoFile":"./tsconfig.lib.tsbuildinfo"},"referencedMap":[[85,1],[86,2],[96,3],[97,3],[99,4],[100,5],[101,6],[102,7],[103,8],[104,9],[105,10],[106,11],[107,12],[108,13],[109,13],[111,14],[110,15],[112,14],[113,16],[114,17],[98,18],[148,19],[115,20],[116,21],[117,22],[149,23],[118,24],[119,25],[120,26],[121,27],[122,28],[123,29],[124,30],[125,31],[126,32],[127,33],[128,33],[129,34],[130,35],[132,36],[131,37],[133,38],[134,39],[135,19],[136,40],[137,41],[138,42],[139,43],[140,44],[141,45],[142,46],[143,47],[144,48],[145,49],[146,50],[147,51],[88,52],[82,53],[81,19],[60,54],[59,19],[57,19],[58,19],[11,19],[10,19],[2,19],[12,19],[13,19],[14,19],[15,19],[16,19],[17,19],[18,19],[19,19],[3,19],[20,19],[21,19],[4,19],[22,19],[26,19],[23,19],[24,19],[25,19],[27,19],[28,19],[29,19],[5,19],[30,19],[31,19],[32,19],[33,19],[6,19],[37,19],[34,19],[35,19],[36,19],[38,19],[7,19],[39,19],[44,19],[45,19],[40,19],[41,19],[42,19],[43,19],[8,19],[49,19],[46,19],[47,19],[48,19],[50,19],[9,19],[51,19],[52,19],[53,19],[55,19],[54,19],[1,19],[56,19],[74,55],[65,56],[72,57],[67,19],[68,19],[66,58],[69,59],[61,19],[62,19],[73,60],[64,61],[70,19],[71,62],[63,63],[75,64],[94,65],[95,66],[93,67],[78,19],[77,68],[79,69],[76,19],[80,19],[83,70],[91,19],[92,71],[84,19],[87,72],[90,19],[89,73]],"latestChangedDtsFile":"./index.d.ts","version":"5.8.3"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import baseConfig from '../../eslint.config.mjs';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
...baseConfig,
|
|
5
|
+
{
|
|
6
|
+
files: ['**/*.json'],
|
|
7
|
+
rules: {
|
|
8
|
+
'@nx/dependency-checks': [
|
|
9
|
+
'error',
|
|
10
|
+
{
|
|
11
|
+
ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}'],
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
languageOptions: {
|
|
16
|
+
parser: await import('jsonc-eslint-parser'),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
];
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-harness/platform-vega",
|
|
3
|
+
"description": "Vega platform for React Native Harness",
|
|
4
|
+
"version": "1.0.0-alpha.18",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
".": {
|
|
12
|
+
"development": "./src/index.ts",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"zod": "^3.25.67",
|
|
20
|
+
"tslib": "^2.3.0",
|
|
21
|
+
"@react-native-harness/platforms": "1.0.0-alpha.18",
|
|
22
|
+
"@react-native-harness/tools": "1.0.0-alpha.18"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT"
|
|
25
|
+
}
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const VegaEmulatorSchema = z.object({
|
|
4
|
+
type: z.literal('emulator'),
|
|
5
|
+
deviceId: z
|
|
6
|
+
.string()
|
|
7
|
+
.min(
|
|
8
|
+
1,
|
|
9
|
+
'Virtual device instance name is required (e.g., "VegaTV_1", "VegaTV_Debug")'
|
|
10
|
+
),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const VegaDeviceSchema = z.discriminatedUnion('type', [
|
|
14
|
+
VegaEmulatorSchema,
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
export const VegaPlatformConfigSchema = z.object({
|
|
18
|
+
name: z.string().min(1, 'Name is required'),
|
|
19
|
+
device: VegaDeviceSchema,
|
|
20
|
+
bundleId: z.string().min(1, 'Bundle ID is required'),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type VegaEmulator = z.infer<typeof VegaEmulatorSchema>;
|
|
24
|
+
export type VegaDevice = z.infer<typeof VegaDeviceSchema>;
|
|
25
|
+
export type VegaPlatformConfig = z.infer<typeof VegaPlatformConfigSchema>;
|
|
26
|
+
|
|
27
|
+
export const isVegaDeviceEmulator = (
|
|
28
|
+
device: VegaDevice
|
|
29
|
+
): device is VegaEmulator => {
|
|
30
|
+
return device.type === 'emulator';
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export function assertVegaDeviceEmulator(
|
|
34
|
+
device: VegaDevice
|
|
35
|
+
): asserts device is VegaEmulator {
|
|
36
|
+
if (!isVegaDeviceEmulator(device)) {
|
|
37
|
+
throw new Error('Device is not an emulator');
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/factory.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DeviceNotFoundError,
|
|
3
|
+
AppNotInstalledError,
|
|
4
|
+
HarnessPlatform,
|
|
5
|
+
} from '@react-native-harness/platforms';
|
|
6
|
+
import {
|
|
7
|
+
VegaPlatformConfigSchema,
|
|
8
|
+
type VegaPlatformConfig,
|
|
9
|
+
type VegaEmulator,
|
|
10
|
+
} from './config.js';
|
|
11
|
+
import * as kepler from './kepler.js';
|
|
12
|
+
|
|
13
|
+
export const vegaEmulator = (deviceId: string): VegaEmulator => ({
|
|
14
|
+
type: 'emulator',
|
|
15
|
+
deviceId,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const vegaPlatform = (config: VegaPlatformConfig): HarnessPlatform => ({
|
|
19
|
+
name: config.name,
|
|
20
|
+
getInstance: async () => {
|
|
21
|
+
const parsedConfig = VegaPlatformConfigSchema.parse(config);
|
|
22
|
+
const deviceId = parsedConfig.device.deviceId;
|
|
23
|
+
const bundleId = parsedConfig.bundleId;
|
|
24
|
+
const deviceStatus = await kepler.getVegaDeviceStatus(deviceId);
|
|
25
|
+
|
|
26
|
+
if (deviceStatus === 'stopped') {
|
|
27
|
+
throw new DeviceNotFoundError(deviceId);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const isInstalled = await kepler.isAppInstalled(deviceId, bundleId);
|
|
31
|
+
|
|
32
|
+
if (!isInstalled) {
|
|
33
|
+
throw new AppNotInstalledError(bundleId, deviceId);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
startApp: async () => {
|
|
38
|
+
await kepler.startApp(deviceId, bundleId);
|
|
39
|
+
},
|
|
40
|
+
restartApp: async () => {
|
|
41
|
+
await kepler.stopApp(deviceId, bundleId);
|
|
42
|
+
await kepler.startApp(deviceId, bundleId);
|
|
43
|
+
},
|
|
44
|
+
stopApp: async () => {
|
|
45
|
+
await kepler.stopApp(deviceId, bundleId);
|
|
46
|
+
},
|
|
47
|
+
dispose: async () => {
|
|
48
|
+
await kepler.stopApp(deviceId, bundleId);
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
});
|
package/src/index.ts
ADDED
package/src/kepler.ts
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { spawn } from '@react-native-harness/tools';
|
|
2
|
+
|
|
3
|
+
export type VegaVirtualDeviceStatus = 'running' | 'stopped';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* List all available Vega virtual devices
|
|
7
|
+
* Returns array of device identifiers that can be used with kepler commands
|
|
8
|
+
*/
|
|
9
|
+
export const listVegaDevices = async (): Promise<string[]> => {
|
|
10
|
+
try {
|
|
11
|
+
const { stdout } = await spawn('kepler', ['device', 'list']);
|
|
12
|
+
const lines = stdout.trim().split('\n');
|
|
13
|
+
const devices: string[] = [];
|
|
14
|
+
|
|
15
|
+
for (const line of lines) {
|
|
16
|
+
if (line.trim()) {
|
|
17
|
+
// Parse device line format: "VirtualDevice : tv - x86_64 - OS - hostname"
|
|
18
|
+
// or potentially "VegaTV_1 : tv - x86_64 - OS - hostname" for named instances
|
|
19
|
+
const deviceId = line.split(' : ')[0].trim();
|
|
20
|
+
if (
|
|
21
|
+
deviceId &&
|
|
22
|
+
(deviceId === 'VirtualDevice' || deviceId.startsWith('Vega'))
|
|
23
|
+
) {
|
|
24
|
+
devices.push(deviceId);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return devices;
|
|
30
|
+
} catch {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Check if a specific Vega virtual device is connected/available
|
|
37
|
+
*/
|
|
38
|
+
export const isVegaDeviceConnected = async (
|
|
39
|
+
deviceId: string
|
|
40
|
+
): Promise<boolean> => {
|
|
41
|
+
try {
|
|
42
|
+
const { stdout } = await spawn('kepler', [
|
|
43
|
+
'device',
|
|
44
|
+
'is-connected',
|
|
45
|
+
'--device',
|
|
46
|
+
deviceId,
|
|
47
|
+
]);
|
|
48
|
+
return stdout.includes('is connected');
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Launch an already installed app on specified Vega virtual device
|
|
56
|
+
*/
|
|
57
|
+
export const startApp = async (
|
|
58
|
+
deviceId: string,
|
|
59
|
+
bundleId: string
|
|
60
|
+
): Promise<void> => {
|
|
61
|
+
await spawn('kepler', [
|
|
62
|
+
'device',
|
|
63
|
+
'launch-app',
|
|
64
|
+
'--device',
|
|
65
|
+
deviceId,
|
|
66
|
+
'--appName',
|
|
67
|
+
bundleId,
|
|
68
|
+
]);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Check if an app is installed on the specified Vega virtual device
|
|
73
|
+
*/
|
|
74
|
+
export const isAppInstalled = async (
|
|
75
|
+
deviceId: string,
|
|
76
|
+
bundleId: string
|
|
77
|
+
): Promise<boolean> => {
|
|
78
|
+
try {
|
|
79
|
+
await spawn('kepler', [
|
|
80
|
+
'device',
|
|
81
|
+
'is-app-installed',
|
|
82
|
+
'--device',
|
|
83
|
+
deviceId,
|
|
84
|
+
'--appName',
|
|
85
|
+
bundleId,
|
|
86
|
+
]);
|
|
87
|
+
return true;
|
|
88
|
+
} catch {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Check if an app is currently running on the specified Vega virtual device
|
|
95
|
+
*/
|
|
96
|
+
export const isAppRunning = async (
|
|
97
|
+
deviceId: string,
|
|
98
|
+
bundleId: string
|
|
99
|
+
): Promise<boolean> => {
|
|
100
|
+
try {
|
|
101
|
+
await spawn('kepler', [
|
|
102
|
+
'device',
|
|
103
|
+
'is-app-running',
|
|
104
|
+
'--device',
|
|
105
|
+
deviceId,
|
|
106
|
+
'--appName',
|
|
107
|
+
bundleId,
|
|
108
|
+
]);
|
|
109
|
+
return true;
|
|
110
|
+
} catch {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const stopApp = async (
|
|
116
|
+
deviceId: string,
|
|
117
|
+
bundleId: string
|
|
118
|
+
): Promise<void> => {
|
|
119
|
+
await spawn('kepler', [
|
|
120
|
+
'device',
|
|
121
|
+
'terminate-app',
|
|
122
|
+
'--device',
|
|
123
|
+
deviceId,
|
|
124
|
+
'--appName',
|
|
125
|
+
bundleId,
|
|
126
|
+
]);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Start port forwarding for debugging on specified Vega virtual device
|
|
131
|
+
*/
|
|
132
|
+
export const startPortForwarding = async (
|
|
133
|
+
deviceId: string,
|
|
134
|
+
port: number,
|
|
135
|
+
forward = true
|
|
136
|
+
): Promise<void> => {
|
|
137
|
+
await spawn('kepler', [
|
|
138
|
+
'device',
|
|
139
|
+
'start-port-forwarding',
|
|
140
|
+
'--device',
|
|
141
|
+
deviceId,
|
|
142
|
+
'--port',
|
|
143
|
+
port.toString(),
|
|
144
|
+
'--forward',
|
|
145
|
+
forward.toString(),
|
|
146
|
+
]);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Stop port forwarding on specified Vega virtual device
|
|
151
|
+
*/
|
|
152
|
+
export const stopPortForwarding = async (
|
|
153
|
+
deviceId: string,
|
|
154
|
+
port: number,
|
|
155
|
+
forward = true
|
|
156
|
+
): Promise<void> => {
|
|
157
|
+
await spawn('kepler', [
|
|
158
|
+
'device',
|
|
159
|
+
'stop-port-forwarding',
|
|
160
|
+
'--device',
|
|
161
|
+
deviceId,
|
|
162
|
+
'--port',
|
|
163
|
+
port.toString(),
|
|
164
|
+
'--forward',
|
|
165
|
+
forward.toString(),
|
|
166
|
+
]);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Get status of a specific Vega virtual device
|
|
171
|
+
* Note: Vega CLI might manage virtual devices globally, so this checks if the device is available
|
|
172
|
+
*/
|
|
173
|
+
export const getVegaDeviceStatus = async (
|
|
174
|
+
deviceId: string
|
|
175
|
+
): Promise<VegaVirtualDeviceStatus> => {
|
|
176
|
+
try {
|
|
177
|
+
// First check if the device is connected/available
|
|
178
|
+
const isConnected = await isVegaDeviceConnected(deviceId);
|
|
179
|
+
if (isConnected) {
|
|
180
|
+
return 'running';
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Check general virtual device status
|
|
184
|
+
const { stdout } = await spawn('kepler', ['virtual-device', 'status']);
|
|
185
|
+
// Parse the status output to determine if VVD is running
|
|
186
|
+
return stdout.toLowerCase().includes('running') ||
|
|
187
|
+
stdout.toLowerCase().includes('ready')
|
|
188
|
+
? 'running'
|
|
189
|
+
: 'stopped';
|
|
190
|
+
} catch {
|
|
191
|
+
return 'stopped';
|
|
192
|
+
}
|
|
193
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"rootDir": "src",
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
|
|
8
|
+
"emitDeclarationOnly": false,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"types": ["node"]
|
|
11
|
+
},
|
|
12
|
+
"include": ["src/**/*.ts"],
|
|
13
|
+
"references": [
|
|
14
|
+
{
|
|
15
|
+
"path": "../tools/tsconfig.lib.json"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "../platforms/tsconfig.lib.json"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|