@mcesystems/adb-kit 1.0.28 → 1.0.30
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/package.json +1 -1
- package/scripts/export-resources.ts +10 -36
package/package.json
CHANGED
|
@@ -38,12 +38,9 @@ const execAsync = promisify(exec);
|
|
|
38
38
|
|
|
39
39
|
// ADB download URLs from Google
|
|
40
40
|
const ADB_URLS: Record<string, string> = {
|
|
41
|
-
windows:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"https://dl.google.com/android/repository/platform-tools-latest-darwin.zip",
|
|
45
|
-
linux:
|
|
46
|
-
"https://dl.google.com/android/repository/platform-tools-latest-linux.zip",
|
|
41
|
+
windows: "https://dl.google.com/android/repository/platform-tools-latest-windows.zip",
|
|
42
|
+
darwin: "https://dl.google.com/android/repository/platform-tools-latest-darwin.zip",
|
|
43
|
+
linux: "https://dl.google.com/android/repository/platform-tools-latest-linux.zip",
|
|
47
44
|
};
|
|
48
45
|
|
|
49
46
|
// Files to extract from platform-tools per platform
|
|
@@ -95,25 +92,14 @@ async function downloadFile(url: string, destPath: string): Promise<void> {
|
|
|
95
92
|
return new Promise((resolve, reject) => {
|
|
96
93
|
const fileStream = createWriteStream(destPath);
|
|
97
94
|
const request = client.get(url, (res) => {
|
|
98
|
-
if (
|
|
99
|
-
res.statusCode &&
|
|
100
|
-
res.statusCode >= 300 &&
|
|
101
|
-
res.statusCode < 400 &&
|
|
102
|
-
res.headers.location
|
|
103
|
-
) {
|
|
95
|
+
if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
104
96
|
// Handle redirect
|
|
105
97
|
fileStream.close();
|
|
106
|
-
return downloadFile(res.headers.location, destPath)
|
|
107
|
-
.then(resolve)
|
|
108
|
-
.catch(reject);
|
|
98
|
+
return downloadFile(res.headers.location, destPath).then(resolve).catch(reject);
|
|
109
99
|
}
|
|
110
100
|
if (res.statusCode && res.statusCode !== 200) {
|
|
111
101
|
fileStream.close();
|
|
112
|
-
reject(
|
|
113
|
-
new Error(
|
|
114
|
-
`Failed to download ${url}: ${res.statusCode} ${res.statusMessage}`
|
|
115
|
-
)
|
|
116
|
-
);
|
|
102
|
+
reject(new Error(`Failed to download ${url}: ${res.statusCode} ${res.statusMessage}`));
|
|
117
103
|
return;
|
|
118
104
|
}
|
|
119
105
|
res.pipe(fileStream);
|
|
@@ -156,10 +142,7 @@ async function downloadFile(url: string, destPath: string): Promise<void> {
|
|
|
156
142
|
}
|
|
157
143
|
}
|
|
158
144
|
|
|
159
|
-
async function extractZip(
|
|
160
|
-
zipPath: string,
|
|
161
|
-
extractDir: string
|
|
162
|
-
): Promise<void> {
|
|
145
|
+
async function extractZip(zipPath: string, extractDir: string): Promise<void> {
|
|
163
146
|
console.log(`Extracting ${zipPath}...`);
|
|
164
147
|
|
|
165
148
|
if (process.platform === "win32") {
|
|
@@ -190,11 +173,7 @@ async function extractZip(
|
|
|
190
173
|
console.log(`✓ Extracted to ${extractDir}`);
|
|
191
174
|
}
|
|
192
175
|
|
|
193
|
-
async function copyFiles(
|
|
194
|
-
sourceDir: string,
|
|
195
|
-
targetDir: string,
|
|
196
|
-
files: string[]
|
|
197
|
-
): Promise<void> {
|
|
176
|
+
async function copyFiles(sourceDir: string, targetDir: string, files: string[]): Promise<void> {
|
|
198
177
|
mkdirSync(targetDir, { recursive: true });
|
|
199
178
|
|
|
200
179
|
for (const file of files) {
|
|
@@ -232,10 +211,7 @@ async function cleanupDir(dirPath: string): Promise<void> {
|
|
|
232
211
|
|
|
233
212
|
type PlatformType = "windows" | "darwin" | "linux";
|
|
234
213
|
|
|
235
|
-
async function exportPlatformResources(
|
|
236
|
-
platform: PlatformType,
|
|
237
|
-
targetDir: string
|
|
238
|
-
): Promise<void> {
|
|
214
|
+
async function exportPlatformResources(platform: PlatformType, targetDir: string): Promise<void> {
|
|
239
215
|
console.log(`\n=== Exporting ${platform} Resources ===\n`);
|
|
240
216
|
|
|
241
217
|
const binDir = path.join(targetDir, "bin", platform);
|
|
@@ -329,8 +305,7 @@ async function main(): Promise<void> {
|
|
|
329
305
|
platforms = [platformArg];
|
|
330
306
|
} else {
|
|
331
307
|
// Default to current platform
|
|
332
|
-
const currentPlatform =
|
|
333
|
-
process.platform === "win32" ? "windows" : process.platform;
|
|
308
|
+
const currentPlatform = process.platform === "win32" ? "windows" : process.platform;
|
|
334
309
|
if (!["windows", "darwin", "linux"].includes(currentPlatform)) {
|
|
335
310
|
console.error(`Unsupported platform: ${currentPlatform}`);
|
|
336
311
|
process.exit(1);
|
|
@@ -365,4 +340,3 @@ main().catch((error) => {
|
|
|
365
340
|
console.error("Export failed:", error);
|
|
366
341
|
process.exit(1);
|
|
367
342
|
});
|
|
368
|
-
|