Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

app.config.ts

181 lines4.9 KB

1import type { ExpoConfig } from "expo/config";
2​
3import { loadRepoEnv } from "../../scripts/lib/public-config.ts";
4​
5type AppVariant = "development" | "preview" | "production";
6​
7const repoEnv = loadRepoEnv();
8Object.assign(process.env, repoEnv);
9​
10const APP_VARIANT = resolveAppVariant(repoEnv.APP_VARIANT);
11​
12const VARIANT_CONFIG: Record<
13 AppVariant,
14 {
15 readonly appName: string;
16 readonly scheme: string;
17 readonly iosIcon: string;
18 readonly iosBundleIdentifier: string;
19 readonly androidPackage: string;
20 }
21> = {
22 development: {
23 appName: "T3 Code Dev",
24 scheme: "t3code-dev",
25 iosIcon: "./assets/icon-composer-dev.icon",
26 iosBundleIdentifier: "com.t3tools.t3code.dev",
27 androidPackage: "com.t3tools.t3code.dev",
28 },
29 preview: {
30 appName: "T3 Code Preview",
31 scheme: "t3code-preview",
32 iosIcon: "./assets/icon-composer-prod.icon",
33 iosBundleIdentifier: "com.t3tools.t3code.preview",
34 androidPackage: "com.t3tools.t3code.preview",
35 },
36 production: {
37 appName: "T3 Code",
38 scheme: "t3code",
39 iosIcon: "./assets/icon-composer-prod.icon",
40 iosBundleIdentifier: "com.t3tools.t3code",
41 androidPackage: "com.t3tools.t3code",
42 },
43};
44​
45function resolveAppVariant(value: string | undefined): AppVariant {
46 switch (value) {
47 case "development":
48 case "preview":
49 case "production":
50 return value;
51 default:
52 return "production";
53 }
55​
56const variant = VARIANT_CONFIG[APP_VARIANT];
57​
58const config: ExpoConfig = {
59 name: variant.appName,
60 slug: "t3-code",
61 platforms: ["ios", "android"],
62 scheme: variant.scheme,
63 version: "0.1.0",
64 runtimeVersion: {
65 policy: process.env.MOBILE_VERSION_POLICY ?? "appVersion",
66 },
67 orientation: "portrait",
68 icon: "./assets/icon.png",
69 userInterfaceStyle: "automatic",
70 updates: {
71 enabled: true,
72 url: "https://u.expo.dev/d763fcb8-d37c-41ea-a773-b54a0ab4a454",
73 checkAutomatically: "ON_LOAD",
74 fallbackToCacheTimeout: 0,
75 },
76 ios: {
77 icon: variant.iosIcon,
78 supportsTablet: true,
79 bundleIdentifier: variant.iosBundleIdentifier,
80 infoPlist: {
81 NSAppTransportSecurity: {
82 NSAllowsArbitraryLoads: true,
83 },
84 NSLocalNetworkUsageDescription:
85 "Allow T3 Code to connect to T3 Code servers on your local network or tailnet.",
86 ITSAppUsesNonExemptEncryption: false,
87 },
88 },
89 android: {
90 icon: "./assets/icon.png",
91 package: variant.androidPackage,
92 adaptiveIcon: {
93 backgroundColor: "#E6F4FE",
94 foregroundImage: "./assets/android-icon-foreground.png",
95 backgroundImage: "./assets/android-icon-background.png",
96 monochromeImage: "./assets/android-icon-monochrome.png",
97 },
98 predictiveBackGestureEnabled: false,
99 },
100 web: {
101 favicon: "./assets/favicon.png",
102 },
103 plugins: [
104 "expo-router",
105 "expo-font",
106 "expo-secure-store",
107 ["@clerk/expo", { theme: "./clerk-theme.json" }],
108 "expo-web-browser",
109 [
110 "expo-camera",
111 {
112 cameraPermission: "Allow T3 Code to access your camera so you can scan pairing QR codes.",
113 barcodeScannerEnabled: true,
114 },
115 ],
116 [
117 "expo-splash-screen",
118 {
119 image: "./assets/splash-icon.png",
120 resizeMode: "contain",
121 backgroundColor: "#ffffff",
122 imageWidth: 220,
123 dark: {
124 image: "./assets/splash-icon.png",
125 backgroundColor: "#0a0a0a",
126 },
127 },
128 ],
129 [
130 "expo-build-properties",
131 {
132 ios: {
133 deploymentTarget: "18.0",
134 // AppCheckCore 11.3+ includes Swift and needs module maps for these Objective-C dependencies.
135 extraPods: [
136 { name: "GoogleUtilities", modular_headers: true },
137 { name: "RecaptchaInterop", modular_headers: true },
138 ],
139 },
140 },
141 ],
142 [
143 "expo-widgets",
144 {
145 bundleIdentifier: `${variant.iosBundleIdentifier}.widgets`,
146 groupIdentifier: `group.${variant.iosBundleIdentifier}`,
147 enablePushNotifications: true,
148 widgets: [
149 {
150 name: "AgentActivity",
151 displayName: "Agent Activity",
152 description: "Shows the current state of active T3 Code agents.",
153 supportedFamilies: ["systemSmall", "systemMedium", "accessoryRectangular"],
154 },
155 ],
156 },
157 ],
158 "./plugins/withAndroidCleartextTraffic.cjs",
159 ],
160 extra: {
161 appVariant: APP_VARIANT,
162 relay: {
163 url: repoEnv.T3CODE_RELAY_URL ?? null,
164 },
165 clerk: {
166 publishableKey: repoEnv.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY ?? null,
167 jwtTemplate: repoEnv.EXPO_PUBLIC_CLERK_JWT_TEMPLATE ?? null,
168 },
169 observability: {
170 tracesUrl: repoEnv.EXPO_PUBLIC_OTLP_TRACES_URL ?? "https://api.axiom.co/v1/traces",
171 tracesDataset: repoEnv.EXPO_PUBLIC_OTLP_TRACES_DATASET ?? null,
172 tracesToken: repoEnv.EXPO_PUBLIC_OTLP_TRACES_TOKEN ?? null,
173 },
174 eas: {
175 projectId: "d763fcb8-d37c-41ea-a773-b54a0ab4a454",
176 },
177 },
178 owner: "pingdotgg",
179};
180​
181export default config;