Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"dev": "wxt",
"dev:firefox": "wxt -b firefox",
"dev:android": "node scripts/dev-android.js",
"dev:android": "node scripts/dev-android.ts",
"build": "wxt build",
"build:firefox": "wxt build -b firefox",
"zip": "wxt zip",
Expand Down
68 changes: 48 additions & 20 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions scripts/dev-android.js → scripts/dev-android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// Get the device ID from command line arguments
const deviceId = process.argv[2];
const deviceId: string | undefined = process.argv[2];
if (!deviceId) {
console.error('Usage: pnpm dev:android <device-id> [web-ext flags...]');
console.error('Example: pnpm dev:android emulator-5554 --source-dir ./custom-dir');
process.exit(1);
}

// Get any additional flags to pass to web-ext
const additionalFlags = process.argv.slice(3);
const additionalFlags: string[] = process.argv.slice(3);

// Extract custom source directory if provided
let customSourceDir = null;
let customSourceDir: string | null = null;
const sourceDirIndex = additionalFlags.findIndex(flag => flag === '--source-dir' || flag === '-s');

if (sourceDirIndex !== -1) {
Expand All @@ -38,7 +38,7 @@ const wxtOutDir = customSourceDir || '.output';
const actualBuildDir = `${wxtOutDir}/firefox-mv2`;

// Remove source-dir flags from additional flags (we'll set it ourselves)
const filteredFlags = [];
const filteredFlags: string[] = [];
for (let i = 0; i < additionalFlags.length; i++) {
const flag = additionalFlags[i];
if (flag === '--source-dir' || flag === '-s') {
Expand Down Expand Up @@ -67,7 +67,7 @@ try {

console.log(`Running on Android device ${deviceId}...`);
execSync(webExtCommand, { stdio: 'inherit', cwd: path.dirname(__dirname) });
} catch (error) {
} catch (error: any) {
console.error('Command failed:', error.message);
process.exit(1);
}