forked from mozilla-extensions/firefox-translations
-
Notifications
You must be signed in to change notification settings - Fork 1
/
web-ext-config.js
87 lines (81 loc) · 2.75 KB
/
web-ext-config.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* eslint-env node */
const path = require("path");
const urlsToOpenOnRun = [
"http://0.0.0.0:4000/fixtures/multiple-frames.html",
"http://0.0.0.0:4000/fixtures/newstest2013.es.top10lines.html",
"http://0.0.0.0:4000/fixtures/newstest2013.es.top300lines.html",
"http://0.0.0.0:4000/fixtures/wmt18.et.top10lines.html",
"http://0.0.0.0:4000/fixtures/es.wikipedia.org-2020-11-21-full-page/original.html",
"http://0.0.0.0:4000/fixtures/es.wikipedia.org-2021-01-20-welcome-box/original.html",
"http://0.0.0.0:4000/fixtures/es.wikipedia.org-2020-11-21-events-on-nov-21-box/original.html",
"https://es.wikipedia.org",
"https://www.mozilla.org/",
"https://www.mozilla.org/es-ES/",
"https://www.mozilla.org/fr/",
"https://www.mozilla.org/fi/",
];
const {
buildPath,
targetEnvironment,
targetBrowser,
ui,
extensionId,
} = require("./build-config.js");
const sourceDir = buildPath;
const artifactsDir = path.join(
".",
"dist",
targetEnvironment,
targetBrowser,
ui,
);
const defaultConfig = {
// Global options:
sourceDir,
artifactsDir,
ignoreFiles: [".DS_Store"],
// Command options:
build: {
overwriteDest: true,
},
run: {
browserConsole: ui === "firefox-infobar-ui",
},
};
if (targetBrowser === "firefox") {
defaultConfig.run.firefox = process.env.FIREFOX_BINARY || "nightly";
defaultConfig.run.target = ["firefox-desktop"];
defaultConfig.run.startUrl = [
`about:devtools-toolbox?type=extension&id=${encodeURIComponent(
extensionId,
)}`,
`http://localhost:${process.env.REMOTE_DEV_SERVER_PORT}/`,
...urlsToOpenOnRun,
"about:debugging#/runtime/this-firefox",
];
defaultConfig.run.pref = [
`extensions.translations.disabled=true`,
"extensions.experiments.enabled=true",
"dom.postMessage.sharedArrayBuffer.bypassCOOP_COEP.insecure.enabled=true",
"javascript.options.wasm_simd=true",
"javascript.options.wasm_simd_wormhole=true",
"extensions.translations.telemetryInactivityThresholdInSecondsOverride=10",
"browser.aboutConfig.showWarning=false",
"browser.ctrlTab.recentlyUsedOrder=false",
];
defaultConfig.filename =
ui === "firefox-infobar-ui"
? `firefox-translations-{version}.xpi`
: `bergamot-browser-extension-{version}-firefox-cross-browser-ui.xpi`;
}
if (targetBrowser === "chrome") {
defaultConfig.run.target = ["chromium"];
defaultConfig.run.args = ["--js-flags=--experimental-wasm-simd"];
defaultConfig.run.startUrl = [
// "chrome://extensions", // Not available until https://github.com/mozilla/web-ext/issues/1979 is resolved
`http://localhost:${process.env.REMOTE_DEV_SERVER_PORT}/`,
...urlsToOpenOnRun,
];
defaultConfig.filename = `bergamot-browser-extension-{version}-chrome-cross-browser-ui.zip`;
}
module.exports = defaultConfig;