Repository navigation
Expand file tree
/
Copy pathapp.config.js
More file actions
64 lines (63 loc) · 1.93 KB
/
Copy pathapp.config.js
File metadata and controls
64 lines (63 loc) · 1.93 KB
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
const { existsSync } = require("node:fs");
const { resolve } = require("node:path");
module.exports = ({ config }) => {
const variant = process.env.BB_MOBILE_VARIANT ?? "production";
if (variant !== "production" && variant !== "dev") {
throw new Error("BB_MOBILE_VARIANT must be production or dev");
}
const isDev = variant === "dev";
const googleServicesFile = process.env.GOOGLE_SERVICES_JSON
? resolve(process.env.GOOGLE_SERVICES_JSON)
: resolve(__dirname, "google-services.json");
if (
!isDev &&
process.env.GOOGLE_SERVICES_JSON &&
!existsSync(googleServicesFile)
) {
throw new Error(
"GOOGLE_SERVICES_JSON must point to an existing Firebase configuration file",
);
}
return {
...config,
extra: { ...config.extra, bbMobileVariant: variant },
...(isDev
? {
name: "bb dev",
icon: "./assets/icon-dev.png",
web: { ...config.web, favicon: "./assets/favicon-dev.png" },
plugins: config.plugins.map((plugin) =>
Array.isArray(plugin) && plugin[0] === "expo-splash-screen"
? [
plugin[0],
{
...plugin[1],
image: "./assets/splash-logo-dev.png",
dark: {
...plugin[1].dark,
image: "./assets/splash-logo-dev.png",
},
},
]
: plugin,
),
}
: {}),
android: {
...config.android,
...(isDev
? {
package: "app.getbb.mobile.dev",
googleServicesFile: undefined,
intentFilters: [],
adaptiveIcon: {
...config.android.adaptiveIcon,
foregroundImage: "./assets/android-icon-foreground-dev.png",
},
}
: existsSync(googleServicesFile)
? { googleServicesFile }
: {}),
},
};
};