@houwert/conductor 0.13.0 → 0.14.0
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/dist/android/sdk.js +149 -0
- package/dist/commands/delete-device.js +17 -5
- package/dist/commands/device-pool.js +2 -1
- package/dist/commands/download-app.js +3 -2
- package/dist/commands/foreground-app.js +1 -0
- package/dist/commands/hprof.js +422 -0
- package/dist/commands/install-app.js +2 -9
- package/dist/commands/list-apps.js +2 -1
- package/dist/commands/list-devices.js +27 -3
- package/dist/commands/memory.js +716 -63
- package/dist/commands/run-parallel.js +2 -1
- package/dist/commands/start-device.js +12 -14
- package/dist/commands/stop-device.js +2 -1
- package/dist/daemon/server.js +2 -0
- package/dist/daemon/web-server.js +38 -0
- package/dist/drivers/android.js +6 -3
- package/dist/drivers/bootstrap.js +48 -9
- package/dist/drivers/log-sources/android.js +6 -6
- package/dist/drivers/log-sources/metro-discovery.js +8 -2
- package/dist/drivers/web.js +16 -2
- package/dist/index.js +26 -1
- package/dist/runner.js +9 -3
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ exports.HELP = void 0;
|
|
|
4
4
|
exports.installApp = installApp;
|
|
5
5
|
exports.HELP = ` install-app <path> Install .app / .ipa / .apk onto device`;
|
|
6
6
|
const runner_js_1 = require("../runner.js");
|
|
7
|
+
const sdk_js_1 = require("../android/sdk.js");
|
|
7
8
|
const session_js_1 = require("../session.js");
|
|
8
9
|
const output_js_1 = require("../output.js");
|
|
9
10
|
const bootstrap_js_1 = require("../drivers/bootstrap.js");
|
|
@@ -36,15 +37,7 @@ async function installApp(appPath, opts = {}, sessionName = 'default') {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
else {
|
|
39
|
-
const result = await (0, runner_js_1.spawnCommand)('adb', [
|
|
40
|
-
'-s',
|
|
41
|
-
deviceId,
|
|
42
|
-
'install',
|
|
43
|
-
'-r',
|
|
44
|
-
'-t',
|
|
45
|
-
'-g',
|
|
46
|
-
appPath,
|
|
47
|
-
]);
|
|
40
|
+
const result = await (0, runner_js_1.spawnCommand)((0, sdk_js_1.resolveAndroidTool)('adb'), ['-s', deviceId, 'install', '-r', '-t', '-g', appPath], { env: (0, sdk_js_1.androidSpawnEnv)() });
|
|
48
41
|
if (!result.success) {
|
|
49
42
|
(0, output_js_1.printError)(`install-app failed: ${result.stderr}`, opts);
|
|
50
43
|
return 1;
|
|
@@ -4,6 +4,7 @@ exports.HELP = void 0;
|
|
|
4
4
|
exports.listApps = listApps;
|
|
5
5
|
exports.HELP = ` list-apps List installed app IDs / package names`;
|
|
6
6
|
const runner_js_1 = require("../runner.js");
|
|
7
|
+
const sdk_js_1 = require("../android/sdk.js");
|
|
7
8
|
const session_js_1 = require("../session.js");
|
|
8
9
|
const output_js_1 = require("../output.js");
|
|
9
10
|
const bootstrap_js_1 = require("../drivers/bootstrap.js");
|
|
@@ -44,7 +45,7 @@ async function listApps(opts = {}, sessionName = 'default') {
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
else {
|
|
47
|
-
const result = await (0, runner_js_1.spawnCommand)('adb', ['-s', deviceId, 'shell', 'pm', 'list', 'packages']);
|
|
48
|
+
const result = await (0, runner_js_1.spawnCommand)((0, sdk_js_1.resolveAndroidTool)('adb'), ['-s', deviceId, 'shell', 'pm', 'list', 'packages'], { env: (0, sdk_js_1.androidSpawnEnv)() });
|
|
48
49
|
if (!result.success) {
|
|
49
50
|
(0, output_js_1.printError)(`list-apps failed: ${result.stderr}`, opts);
|
|
50
51
|
return 1;
|
|
@@ -10,14 +10,21 @@ exports.listDevices = listDevices;
|
|
|
10
10
|
exports.HELP = ` list-devices List booted and available devices/simulators`;
|
|
11
11
|
const fs_1 = __importDefault(require("fs"));
|
|
12
12
|
const runner_js_1 = require("../runner.js");
|
|
13
|
+
const sdk_js_1 = require("../android/sdk.js");
|
|
13
14
|
const output_js_1 = require("../output.js");
|
|
14
15
|
const bootstrap_js_1 = require("../drivers/bootstrap.js");
|
|
15
16
|
const client_js_1 = require("../daemon/client.js");
|
|
16
17
|
const protocol_js_1 = require("../daemon/protocol.js");
|
|
18
|
+
// Captured during discoverAvailableDevices so listDevices() can report it.
|
|
19
|
+
// Module-scoped because the discover function returns Device[]; bolting an
|
|
20
|
+
// extra return field onto the public type would ripple beyond this fix.
|
|
21
|
+
let listAvdsError;
|
|
17
22
|
async function discoverBootedDevices() {
|
|
18
23
|
const devices = [];
|
|
19
24
|
// Try adb devices (Android)
|
|
20
|
-
const adb = await (0, runner_js_1.spawnCommand)('adb', ['devices', '-l']
|
|
25
|
+
const adb = await (0, runner_js_1.spawnCommand)((0, sdk_js_1.resolveAndroidTool)('adb'), ['devices', '-l'], {
|
|
26
|
+
env: (0, sdk_js_1.androidSpawnEnv)(),
|
|
27
|
+
});
|
|
21
28
|
if (adb.success || adb.stdout.includes('List of devices')) {
|
|
22
29
|
const lines = adb.stdout.split('\n').slice(1); // skip header
|
|
23
30
|
for (const line of lines) {
|
|
@@ -85,6 +92,7 @@ async function discoverBootedDevices() {
|
|
|
85
92
|
}
|
|
86
93
|
async function discoverAvailableDevices() {
|
|
87
94
|
const devices = [];
|
|
95
|
+
listAvdsError = undefined;
|
|
88
96
|
// iOS: all available simulators that are not booted
|
|
89
97
|
const xcrun = await (0, runner_js_1.spawnCommand)('xcrun', ['simctl', 'list', 'devices', '--json']);
|
|
90
98
|
if (xcrun.success) {
|
|
@@ -108,7 +116,9 @@ async function discoverAvailableDevices() {
|
|
|
108
116
|
}
|
|
109
117
|
}
|
|
110
118
|
// Android: list available AVDs
|
|
111
|
-
const emu = await (0, runner_js_1.spawnCommand)('emulator', ['-list-avds']
|
|
119
|
+
const emu = await (0, runner_js_1.spawnCommand)((0, sdk_js_1.resolveAndroidTool)('emulator'), ['-list-avds'], {
|
|
120
|
+
env: (0, sdk_js_1.androidSpawnEnv)(),
|
|
121
|
+
});
|
|
112
122
|
if (emu.success) {
|
|
113
123
|
for (const line of emu.stdout.split('\n')) {
|
|
114
124
|
const name = line.trim();
|
|
@@ -117,6 +127,11 @@ async function discoverAvailableDevices() {
|
|
|
117
127
|
}
|
|
118
128
|
}
|
|
119
129
|
}
|
|
130
|
+
else {
|
|
131
|
+
// Surface the failure so users know why no AVDs showed up. Stash the
|
|
132
|
+
// message on the function for listDevices() to log/include.
|
|
133
|
+
listAvdsError = (emu.stderr || emu.stdout || 'unknown error').trim();
|
|
134
|
+
}
|
|
120
135
|
// Web: installed Playwright browsers that aren't currently running
|
|
121
136
|
const runningSessions = (0, client_js_1.listDaemonSessions)();
|
|
122
137
|
const runningBrowsers = new Set(runningSessions.filter((s) => s === 'web' || s.startsWith('web:')).map((s) => (0, bootstrap_js_1.webBrowserName)(s)));
|
|
@@ -138,13 +153,22 @@ async function listDevices(opts) {
|
|
|
138
153
|
discoverAvailableDevices(),
|
|
139
154
|
]);
|
|
140
155
|
if (devices.length === 0 && availableDevices.length === 0) {
|
|
156
|
+
if (listAvdsError && !opts.json) {
|
|
157
|
+
console.error(`warning: emulator -list-avds failed: ${listAvdsError}`);
|
|
158
|
+
}
|
|
141
159
|
(0, output_js_1.printError)('No devices found. Start an emulator or simulator first.', opts);
|
|
142
160
|
return 1;
|
|
143
161
|
}
|
|
144
162
|
if (opts.json) {
|
|
145
|
-
|
|
163
|
+
const payload = { status: 'ok', devices, availableDevices };
|
|
164
|
+
if (listAvdsError)
|
|
165
|
+
payload['warnings'] = [`emulator -list-avds failed: ${listAvdsError}`];
|
|
166
|
+
(0, output_js_1.printData)(payload, opts);
|
|
146
167
|
}
|
|
147
168
|
else {
|
|
169
|
+
if (listAvdsError) {
|
|
170
|
+
console.error(`warning: emulator -list-avds failed: ${listAvdsError}`);
|
|
171
|
+
}
|
|
148
172
|
if (devices.length > 0) {
|
|
149
173
|
console.log('Booted devices:');
|
|
150
174
|
for (const d of devices) {
|