Skip to content

Commit

Permalink
Fixed: Exclude build/*.mjs in .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
mbnuqw committed Mar 5, 2023
1 parent 7db50c3 commit df3de05
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ wiki
addon
build/*
!build/*.js
!build/*.mjs
28 changes: 28 additions & 0 deletions build/webext.run.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import webExt from 'web-ext'
import fs from 'node:fs'
import { ADDON_PATH } from './utils.js'

let lastArg = process.argv[process.argv.length - 1]
if (!lastArg || lastArg.startsWith('-')) lastArg = 'firefox'

const IS_FF = lastArg.includes('irefox')
const cliOpts = {
target: IS_FF ? 'firefox-desktop' : 'chromium',
sourceDir: ADDON_PATH,
keepProfileChanges: true,
}

async function main() {
if (IS_FF) {
cliOpts.firefox = lastArg
cliOpts.firefoxProfile = './build/profile-' + lastArg
await fs.promises.mkdir(cliOpts.firefoxProfile, { recursive: true })
} else {
cliOpts.chromiumBinary = lastArg
cliOpts.chromiumProfile = './build/profile-' + lastArg
await fs.promises.mkdir(cliOpts.chromiumProfile, { recursive: true })
}

webExt.cmd.run(cliOpts, { shouldExitProgram: true })
}
main()

0 comments on commit df3de05

Please sign in to comment.