-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathapp.config.ts
111 lines (102 loc) · 2.94 KB
/
app.config.ts
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import { ExpoConfig } from "@expo/config-types";
import { version } from "./package.json";
// Project constants
const EAS_PROJECT_ID = "012accc3-4ce5-4bae-9f4d-2f842489f07a";
const PROJECT_SLUG = "spacecraft";
const OWNER = "weshipit";
// App production config
const APP_NAME = "Spacecraft";
const BUNDLE_IDENTIFIER = "weshipit.today.spacecraft";
const PACKAGE_NAME = "weshipit.today.spacecraft";
const SCHEME = "spacecraft";
export default ({ config }: { config: ExpoConfig }): ExpoConfig => {
const environment = process.env.APP_ENV || "development";
console.log("⚙️ Building app for environment:", environment);
const { adaptiveIcon, bundleIdentifier, icon, name, packageName, scheme } =
getDynamicAppConfig(
environment as "development" | "preview" | "production",
);
return {
...config,
android: {
adaptiveIcon: {
backgroundColor: "#ffffff",
foregroundImage: adaptiveIcon,
},
package: packageName,
playStoreUrl:
"https://play.google.com/store/apps/details?id=weshipit.today.spacecraft",
},
extra: {
eas: {
projectId: EAS_PROJECT_ID,
},
storybookEnabled: process.env.STORYBOOK_ENABLED,
},
icon: icon,
ios: {
appStoreUrl: "https://apps.apple.com/fr/app/<compagny_name>/idxxxxxxxxx",
bundleIdentifier: bundleIdentifier,
supportsTablet: true,
},
name: name,
newArchEnabled: true,
orientation: "portrait",
owner: OWNER,
plugins: [],
runtimeVersion: {
policy: "appVersion",
},
scheme: scheme,
slug: PROJECT_SLUG,
splash: {
backgroundColor: "#ffffff",
image: "./assets/splash.png",
resizeMode: "contain",
},
updates: {
fallbackToCacheTimeout: 0,
url: `https://u.expo.dev/${EAS_PROJECT_ID}`,
},
userInterfaceStyle: "automatic",
version,
web: {
bundler: "metro",
favicon: "./assets/favicon.png",
output: "static",
},
};
};
// Dynamically configure the app based on the environment
export const getDynamicAppConfig = (
environment: "development" | "preview" | "production",
) => {
if (environment === "production") {
return {
adaptiveIcon: "./assets/adaptive-icon.png",
bundleIdentifier: BUNDLE_IDENTIFIER,
icon: "./assets/icon.png",
name: APP_NAME,
packageName: PACKAGE_NAME,
scheme: SCHEME,
};
}
if (environment === "preview") {
return {
adaptiveIcon: "./assets/adaptive-icon-preview.png",
bundleIdentifier: `${BUNDLE_IDENTIFIER}.preview`,
icon: "./assets/icon-preview.png",
name: `${APP_NAME} Preview`,
packageName: `${PACKAGE_NAME}.preview`,
scheme: `${SCHEME}-prev`,
};
}
return {
adaptiveIcon: "./assets/adaptive-icon-dev.png",
bundleIdentifier: `${BUNDLE_IDENTIFIER}.dev`,
icon: "./assets/icon-dev.png",
name: `${APP_NAME} Development`,
packageName: `${PACKAGE_NAME}.dev`,
scheme: `${SCHEME}-dev`,
};
};