| 32 | }; |
| 33 | |
| 34 | const main = async () => { |
| 35 | const finder = new Finder(); |
| 36 | |
| 37 | const findPathPromise = new Promise((resolvePromise, rejectPromise) => { |
| 38 | finder.getPath(getFirefoxProfileName(), (error, profile) => { |
| 39 | if (error) { |
| 40 | rejectPromise(error); |
| 41 | } else { |
| 42 | resolvePromise(profile); |
| 43 | } |
| 44 | }); |
| 45 | }); |
| 46 | |
| 47 | const options = [ |
| 48 | `--source-dir=${EXTENSION_PATH}`, |
| 49 | `--start-url=${START_URL}`, |
| 50 | '--browser-console', |
| 51 | ]; |
| 52 | |
| 53 | try { |
| 54 | const path = await findPathPromise; |
| 55 | const trimmedPath = path.replace(' ', '\\ '); |
| 56 | options.push(`--firefox-profile=${trimmedPath}`); |
| 57 | } catch (err) { |
| 58 | console.warn('Could not find default profile, using temporary profile.'); |
| 59 | } |
| 60 | |
| 61 | try { |
| 62 | await exec(`web-ext run ${options.join(' ')}`); |
| 63 | } catch (err) { |
| 64 | console.error('`web-ext run` failed', err.stdout, err.stderr); |
| 65 | } |
| 66 | }; |
| 67 | |
| 68 | main(); |