forked from mozilla-extensions/firefox-translations
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-config.js
58 lines (50 loc) · 1.34 KB
/
build-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
/* eslint-env node */
const path = require("path");
if (!process.env.TARGET_BROWSER) {
throw new Error("Missing TARGET_BROWSER env var");
}
if (!process.env.UI) {
throw new Error("Missing UI env var");
}
const targetEnvironment =
process.env.NODE_ENV === "production" ? "production" : "development";
const targetBrowser = process.env.TARGET_BROWSER;
const ui = process.env.UI;
let extensionBuildEnvironment;
if (process.env.MC === "1") {
extensionBuildEnvironment = "mozilla";
} else if (process.env.CIRCLECI === "true") {
extensionBuildEnvironment = "circleci";
} else if (process.env.CI === "true") {
extensionBuildEnvironment = "ci";
} else {
extensionBuildEnvironment = "local";
}
if (targetEnvironment !== "production") {
extensionBuildEnvironment += `:${targetEnvironment}`;
}
const extensionId =
ui === "firefox-infobar-ui"
? `${
process.env.MC === "1"
}`
: "[email protected]";
const buildPath = path.join(
__dirname,
"build",
targetEnvironment,
targetBrowser,
ui,
);
const buildConfig = {
targetEnvironment,
targetBrowser,
ui,
extensionId,
buildPath,
extensionBuildEnvironment,
};
console.info(`Build config: `, buildConfig);
module.exports = buildConfig;