-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev-android.js
More file actions
30 lines (25 loc) · 938 Bytes
/
Copy pathdev-android.js
File metadata and controls
30 lines (25 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env node
import { execSync } from 'child_process';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Get the device ID from command line arguments
const deviceId = process.argv[2];
if (!deviceId) {
console.error('Usage: pnpm dev:android <device-id>');
process.exit(1);
}
// Run the build and web-ext commands
try {
console.log(`Building Firefox extension...`);
execSync('pnpm build:firefox', { stdio: 'inherit', cwd: path.dirname(__dirname) });
console.log(`Running on Android device ${deviceId}...`);
execSync(`web-ext run --target=firefox-android --android-device=${deviceId} --firefox-apk=org.mozilla.fenix --source-dir ./.output/firefox-mv2`, {
stdio: 'inherit',
cwd: path.dirname(__dirname)
});
} catch (error) {
console.error('Command failed:', error.message);
process.exit(1);
}