@mcesystems/adb-kit 1.0.31 → 1.0.33
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 +191 -191
- package/dist/resources/bin/windows/AdbWinApi.dll +0 -0
- package/dist/resources/bin/windows/AdbWinUsbApi.dll +0 -0
- package/dist/resources/bin/windows/adb.exe +0 -0
- package/package.json +1 -1
- package/scripts/README.md +183 -183
- package/scripts/export-resources.ts +342 -342
- package/dist/resources/bin/darwin/adb +0 -0
package/README.md
CHANGED
|
@@ -1,191 +1,191 @@
|
|
|
1
|
-
# @mcesystems/adb-kit
|
|
2
|
-
|
|
3
|
-
ADB (Android Debug Bridge) toolkit for device management. Provides a TypeScript wrapper around adbkit for Android device operations.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Device Operations**: Get device properties, install/uninstall apps
|
|
8
|
-
- **USB Debugging Detection**: Check and wait for USB debugging enabled
|
|
9
|
-
- **Port Forwarding**: Forward local ports to device services
|
|
10
|
-
- **Cross-platform**: Works on Windows, macOS, and Linux
|
|
11
|
-
|
|
12
|
-
## Installation
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npm install @mcesystems/adb-kit
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Requirements
|
|
19
|
-
|
|
20
|
-
- Node.js 18+
|
|
21
|
-
- Android device with USB debugging enabled
|
|
22
|
-
- ADB binaries (see Platform Setup)
|
|
23
|
-
|
|
24
|
-
### Platform Setup
|
|
25
|
-
|
|
26
|
-
#### Using the Export Script (Recommended for Distribution)
|
|
27
|
-
|
|
28
|
-
Use the export script to bundle ADB binaries for your application:
|
|
29
|
-
```bash
|
|
30
|
-
# Using npx (after installing the package)
|
|
31
|
-
npx export-adb-resources /path/to/your-app/resources/adb-kit
|
|
32
|
-
|
|
33
|
-
# Or export for all platforms at once
|
|
34
|
-
npx export-adb-resources /path/to/your-app/resources/adb-kit --all
|
|
35
|
-
|
|
36
|
-
# Or run the script directly
|
|
37
|
-
npx tsx node_modules/@mcesystems/adb-kit/scripts/export-resources.ts /path/to/your-app/resources
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
See [scripts/README.md](./scripts/README.md) for detailed prerequisites and instructions.
|
|
41
|
-
|
|
42
|
-
#### Windows & macOS (Development)
|
|
43
|
-
|
|
44
|
-
Set the `AdbBinPath` environment variable to the ADB binary location, or ensure `adb` is in your system PATH.
|
|
45
|
-
|
|
46
|
-
#### Linux
|
|
47
|
-
|
|
48
|
-
Install ADB via your package manager:
|
|
49
|
-
```bash
|
|
50
|
-
sudo apt install adb # Debian/Ubuntu
|
|
51
|
-
sudo dnf install android-tools # Fedora
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Usage
|
|
55
|
-
|
|
56
|
-
### Basic Device Operations
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
import { AdbDeviceKit } from '@mcesystems/adb-kit';
|
|
60
|
-
|
|
61
|
-
// Create a device kit for a specific device
|
|
62
|
-
const device = new AdbDeviceKit('device-serial-number', 1);
|
|
63
|
-
|
|
64
|
-
// Get device properties
|
|
65
|
-
const [manufacturer, model] = await device.getDeviceProperties(['Manufacturer', 'Model']);
|
|
66
|
-
console.log(`Device: ${manufacturer} ${model}`);
|
|
67
|
-
|
|
68
|
-
// Get all properties
|
|
69
|
-
const allProps = await device.getAllDeviceProperties();
|
|
70
|
-
|
|
71
|
-
// List connected devices
|
|
72
|
-
const devices = await device.listDevices();
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### App Management
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
const device = new AdbDeviceKit('device-serial-number', 1);
|
|
79
|
-
|
|
80
|
-
// Install an APK
|
|
81
|
-
await device.installApp('/path/to/app.apk');
|
|
82
|
-
|
|
83
|
-
// Check if app is installed
|
|
84
|
-
const isInstalled = await device.isAppInstalled('com.example.app');
|
|
85
|
-
|
|
86
|
-
// Uninstall an app
|
|
87
|
-
await device.uninstallApp('com.example.app');
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### USB Debugging
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
const device = new AdbDeviceKit('device-serial-number', 1);
|
|
94
|
-
|
|
95
|
-
// Check if USB debugging is enabled
|
|
96
|
-
const hasDebugging = await device.hasUsbDebugging();
|
|
97
|
-
|
|
98
|
-
// Wait for USB debugging to be enabled (with timeout)
|
|
99
|
-
await device.waitForUsbDebugging(30000); // 30 seconds
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Port Forwarding
|
|
103
|
-
|
|
104
|
-
```typescript
|
|
105
|
-
const device = new AdbDeviceKit('device-serial-number', 1);
|
|
106
|
-
|
|
107
|
-
// Forward a local port to a device service
|
|
108
|
-
const localPort = await device.startPortForward('tcp:8080');
|
|
109
|
-
console.log(`Forwarded to local port: ${localPort}`);
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Access ADB Client
|
|
113
|
-
|
|
114
|
-
```typescript
|
|
115
|
-
const device = new AdbDeviceKit('device-serial-number', 1);
|
|
116
|
-
|
|
117
|
-
// Get the underlying adbkit client for advanced operations
|
|
118
|
-
const client = await device.getClient();
|
|
119
|
-
|
|
120
|
-
// Get the device client for direct device operations
|
|
121
|
-
const deviceClient = await device.getDeviceClient();
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## API Reference
|
|
125
|
-
|
|
126
|
-
### AdbDeviceKit
|
|
127
|
-
|
|
128
|
-
**Constructor:**
|
|
129
|
-
- `new AdbDeviceKit(deviceId: string, port: number)`: Create a device kit
|
|
130
|
-
|
|
131
|
-
**Device Info:**
|
|
132
|
-
- `getDeviceId()`: Get the device serial number
|
|
133
|
-
- `getPort()`: Get the logical port number
|
|
134
|
-
- `getDeviceProperties(properties: DeviceProperty[])`: Get specific device properties
|
|
135
|
-
- `getAllDeviceProperties()`: Get all device properties
|
|
136
|
-
|
|
137
|
-
**Device State:**
|
|
138
|
-
- `hasUsbDebugging()`: Check if USB debugging is enabled
|
|
139
|
-
- `waitForUsbDebugging(timeout?)`: Wait for USB debugging
|
|
140
|
-
|
|
141
|
-
**App Management:**
|
|
142
|
-
- `installApp(apkPath: string)`: Install an APK
|
|
143
|
-
- `uninstallApp(packageName: string)`: Uninstall an app
|
|
144
|
-
- `isAppInstalled(packageName: string)`: Check if app is installed
|
|
145
|
-
|
|
146
|
-
**Port Forwarding:**
|
|
147
|
-
- `startPortForward(serviceName: string)`: Forward to a device service
|
|
148
|
-
|
|
149
|
-
**Advanced:**
|
|
150
|
-
- `getClient()`: Get the adbkit client
|
|
151
|
-
- `getDeviceClient()`: Get the device client
|
|
152
|
-
- `listDevices()`: List all connected devices
|
|
153
|
-
|
|
154
|
-
### DeviceProperty
|
|
155
|
-
|
|
156
|
-
Available device properties:
|
|
157
|
-
- `Manufacturer`, `Name`, `Model`, `Brand`, `Device`
|
|
158
|
-
- `Android Version`, `Platform`, `CPU`, `CPU.abi2`
|
|
159
|
-
- `Description`, `Fingerprint`
|
|
160
|
-
- `GSM Flexversion`, `GSM IMEI`
|
|
161
|
-
- `Locale Language`, `Locale Region`
|
|
162
|
-
- `Wifi Channels`, `Board Platform`, `Product Board`
|
|
163
|
-
- `Display ID`, `Version Incremental`, `Version SDK`
|
|
164
|
-
- `Version Codename`, `Version Release`
|
|
165
|
-
- `Build Date`, `Build Type`, `Build User`
|
|
166
|
-
|
|
167
|
-
## Development
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
# Build the package
|
|
171
|
-
npm run build
|
|
172
|
-
|
|
173
|
-
# Run tests
|
|
174
|
-
npm test
|
|
175
|
-
|
|
176
|
-
# Clean build artifacts
|
|
177
|
-
npm run clean
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### Setting Up ADB for Development
|
|
181
|
-
|
|
182
|
-
For development, you can either:
|
|
183
|
-
1. Use the export script to download ADB to a local path
|
|
184
|
-
2. Install ADB via Homebrew (`brew install android-platform-tools`) or your system package manager
|
|
185
|
-
3. Set `AdbBinPath` environment variable to your ADB installation
|
|
186
|
-
|
|
187
|
-
## License
|
|
188
|
-
|
|
189
|
-
ISC
|
|
190
|
-
|
|
191
|
-
ADB Platform Tools are licensed under the Apache License 2.0.
|
|
1
|
+
# @mcesystems/adb-kit
|
|
2
|
+
|
|
3
|
+
ADB (Android Debug Bridge) toolkit for device management. Provides a TypeScript wrapper around adbkit for Android device operations.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Device Operations**: Get device properties, install/uninstall apps
|
|
8
|
+
- **USB Debugging Detection**: Check and wait for USB debugging enabled
|
|
9
|
+
- **Port Forwarding**: Forward local ports to device services
|
|
10
|
+
- **Cross-platform**: Works on Windows, macOS, and Linux
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @mcesystems/adb-kit
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Requirements
|
|
19
|
+
|
|
20
|
+
- Node.js 18+
|
|
21
|
+
- Android device with USB debugging enabled
|
|
22
|
+
- ADB binaries (see Platform Setup)
|
|
23
|
+
|
|
24
|
+
### Platform Setup
|
|
25
|
+
|
|
26
|
+
#### Using the Export Script (Recommended for Distribution)
|
|
27
|
+
|
|
28
|
+
Use the export script to bundle ADB binaries for your application:
|
|
29
|
+
```bash
|
|
30
|
+
# Using npx (after installing the package)
|
|
31
|
+
npx export-adb-resources /path/to/your-app/resources/adb-kit
|
|
32
|
+
|
|
33
|
+
# Or export for all platforms at once
|
|
34
|
+
npx export-adb-resources /path/to/your-app/resources/adb-kit --all
|
|
35
|
+
|
|
36
|
+
# Or run the script directly
|
|
37
|
+
npx tsx node_modules/@mcesystems/adb-kit/scripts/export-resources.ts /path/to/your-app/resources
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
See [scripts/README.md](./scripts/README.md) for detailed prerequisites and instructions.
|
|
41
|
+
|
|
42
|
+
#### Windows & macOS (Development)
|
|
43
|
+
|
|
44
|
+
Set the `AdbBinPath` environment variable to the ADB binary location, or ensure `adb` is in your system PATH.
|
|
45
|
+
|
|
46
|
+
#### Linux
|
|
47
|
+
|
|
48
|
+
Install ADB via your package manager:
|
|
49
|
+
```bash
|
|
50
|
+
sudo apt install adb # Debian/Ubuntu
|
|
51
|
+
sudo dnf install android-tools # Fedora
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
### Basic Device Operations
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { AdbDeviceKit } from '@mcesystems/adb-kit';
|
|
60
|
+
|
|
61
|
+
// Create a device kit for a specific device
|
|
62
|
+
const device = new AdbDeviceKit('device-serial-number', 1);
|
|
63
|
+
|
|
64
|
+
// Get device properties
|
|
65
|
+
const [manufacturer, model] = await device.getDeviceProperties(['Manufacturer', 'Model']);
|
|
66
|
+
console.log(`Device: ${manufacturer} ${model}`);
|
|
67
|
+
|
|
68
|
+
// Get all properties
|
|
69
|
+
const allProps = await device.getAllDeviceProperties();
|
|
70
|
+
|
|
71
|
+
// List connected devices
|
|
72
|
+
const devices = await device.listDevices();
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### App Management
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
const device = new AdbDeviceKit('device-serial-number', 1);
|
|
79
|
+
|
|
80
|
+
// Install an APK
|
|
81
|
+
await device.installApp('/path/to/app.apk');
|
|
82
|
+
|
|
83
|
+
// Check if app is installed
|
|
84
|
+
const isInstalled = await device.isAppInstalled('com.example.app');
|
|
85
|
+
|
|
86
|
+
// Uninstall an app
|
|
87
|
+
await device.uninstallApp('com.example.app');
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### USB Debugging
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
const device = new AdbDeviceKit('device-serial-number', 1);
|
|
94
|
+
|
|
95
|
+
// Check if USB debugging is enabled
|
|
96
|
+
const hasDebugging = await device.hasUsbDebugging();
|
|
97
|
+
|
|
98
|
+
// Wait for USB debugging to be enabled (with timeout)
|
|
99
|
+
await device.waitForUsbDebugging(30000); // 30 seconds
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Port Forwarding
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
const device = new AdbDeviceKit('device-serial-number', 1);
|
|
106
|
+
|
|
107
|
+
// Forward a local port to a device service
|
|
108
|
+
const localPort = await device.startPortForward('tcp:8080');
|
|
109
|
+
console.log(`Forwarded to local port: ${localPort}`);
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Access ADB Client
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const device = new AdbDeviceKit('device-serial-number', 1);
|
|
116
|
+
|
|
117
|
+
// Get the underlying adbkit client for advanced operations
|
|
118
|
+
const client = await device.getClient();
|
|
119
|
+
|
|
120
|
+
// Get the device client for direct device operations
|
|
121
|
+
const deviceClient = await device.getDeviceClient();
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## API Reference
|
|
125
|
+
|
|
126
|
+
### AdbDeviceKit
|
|
127
|
+
|
|
128
|
+
**Constructor:**
|
|
129
|
+
- `new AdbDeviceKit(deviceId: string, port: number)`: Create a device kit
|
|
130
|
+
|
|
131
|
+
**Device Info:**
|
|
132
|
+
- `getDeviceId()`: Get the device serial number
|
|
133
|
+
- `getPort()`: Get the logical port number
|
|
134
|
+
- `getDeviceProperties(properties: DeviceProperty[])`: Get specific device properties
|
|
135
|
+
- `getAllDeviceProperties()`: Get all device properties
|
|
136
|
+
|
|
137
|
+
**Device State:**
|
|
138
|
+
- `hasUsbDebugging()`: Check if USB debugging is enabled
|
|
139
|
+
- `waitForUsbDebugging(timeout?)`: Wait for USB debugging
|
|
140
|
+
|
|
141
|
+
**App Management:**
|
|
142
|
+
- `installApp(apkPath: string)`: Install an APK
|
|
143
|
+
- `uninstallApp(packageName: string)`: Uninstall an app
|
|
144
|
+
- `isAppInstalled(packageName: string)`: Check if app is installed
|
|
145
|
+
|
|
146
|
+
**Port Forwarding:**
|
|
147
|
+
- `startPortForward(serviceName: string)`: Forward to a device service
|
|
148
|
+
|
|
149
|
+
**Advanced:**
|
|
150
|
+
- `getClient()`: Get the adbkit client
|
|
151
|
+
- `getDeviceClient()`: Get the device client
|
|
152
|
+
- `listDevices()`: List all connected devices
|
|
153
|
+
|
|
154
|
+
### DeviceProperty
|
|
155
|
+
|
|
156
|
+
Available device properties:
|
|
157
|
+
- `Manufacturer`, `Name`, `Model`, `Brand`, `Device`
|
|
158
|
+
- `Android Version`, `Platform`, `CPU`, `CPU.abi2`
|
|
159
|
+
- `Description`, `Fingerprint`
|
|
160
|
+
- `GSM Flexversion`, `GSM IMEI`
|
|
161
|
+
- `Locale Language`, `Locale Region`
|
|
162
|
+
- `Wifi Channels`, `Board Platform`, `Product Board`
|
|
163
|
+
- `Display ID`, `Version Incremental`, `Version SDK`
|
|
164
|
+
- `Version Codename`, `Version Release`
|
|
165
|
+
- `Build Date`, `Build Type`, `Build User`
|
|
166
|
+
|
|
167
|
+
## Development
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Build the package
|
|
171
|
+
npm run build
|
|
172
|
+
|
|
173
|
+
# Run tests
|
|
174
|
+
npm test
|
|
175
|
+
|
|
176
|
+
# Clean build artifacts
|
|
177
|
+
npm run clean
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Setting Up ADB for Development
|
|
181
|
+
|
|
182
|
+
For development, you can either:
|
|
183
|
+
1. Use the export script to download ADB to a local path
|
|
184
|
+
2. Install ADB via Homebrew (`brew install android-platform-tools`) or your system package manager
|
|
185
|
+
3. Set `AdbBinPath` environment variable to your ADB installation
|
|
186
|
+
|
|
187
|
+
## License
|
|
188
|
+
|
|
189
|
+
ISC
|
|
190
|
+
|
|
191
|
+
ADB Platform Tools are licensed under the Apache License 2.0.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|