Open History to see the last commit
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 splashIcon: string;
19 readonly iosBundleIdentifier: string;
20 readonly androidPackage: string;
21 readonly relyingParty?: string;
22 }
23> = {
24 development: {
25 appName: "T3 Code Dev",
26 scheme: "t3code-dev",
27 iosIcon: "./assets/icon-composer-dev.icon",
28 splashIcon: "./assets/splash-icon-dev.png",
29 iosBundleIdentifier: "com.t3tools.t3code.dev",
30 androidPackage: "com.t3tools.t3code.dev",
31 relyingParty: "clerk.t3.codes",
32 },
33 preview: {
34 appName: "T3 Code Preview",
35 scheme: "t3code-preview",
36 iosIcon: "./assets/icon-composer-prod.icon",
37 splashIcon: "./assets/splash-icon-prod.png",
38 iosBundleIdentifier: "com.t3tools.t3code.preview",
39 androidPackage: "com.t3tools.t3code.preview",
40 relyingParty: "clerk.t3.codes",
41 },
42 production: {
43 appName: "T3 Code",
44 scheme: "t3code",
45 iosIcon: "./assets/icon-composer-prod.icon",
46 splashIcon: "./assets/splash-icon-prod.png",
47 iosBundleIdentifier: "com.t3tools.t3code",
48 androidPackage: "com.t3tools.t3code",
49 relyingParty: "clerk.t3.codes",
50 },
51};
52
53function resolveAppVariant(value: string | undefined): AppVariant {
54 switch (value) {
55 case "development":
56 case "preview":
57 case "production":
58 return value;
59 default:
60 return "production";
61 }
62}
63
64const variant = VARIANT_CONFIG[APP_VARIANT];
65
66const config: ExpoConfig = {
67 name: variant.appName,
68 slug: "t3-code",
69 platforms: ["ios", "android"],
70 scheme: variant.scheme,
71 version: "0.1.0",
72 runtimeVersion: {
73 // Fingerprint (not appVersion) so an OTA only reaches binaries whose native
74 // project — native deps, config plugins, AND patches/ — matches the update.
75 // With appVersion, every 0.1.0 build shares a runtime version, so a JS update
76 // could land on a binary missing the native changes it needs and crash.
77 policy: process.env.MOBILE_VERSION_POLICY ?? "fingerprint",
78 },
79 orientation: "portrait",
80 icon: "./assets/icon.png",
81 userInterfaceStyle: "automatic",
82 updates: {
83 enabled: true,
84 url: "https://u.expo.dev/d763fcb8-d37c-41ea-a773-b54a0ab4a454",
85 checkAutomatically: "ON_LOAD",
86 fallbackToCacheTimeout: 0,
87 },
88 ios: {
89 icon: variant.iosIcon,
90 supportsTablet: true,
91 bundleIdentifier: variant.iosBundleIdentifier,
92 // Pin code signing to the T3 Tools team so non-interactive `expo run:ios`
93 // does not fall back to a personal team (which cannot sign app groups,
94 // Sign in with Apple, or push notification entitlements).
95 appleTeamId: "ARK85ZXQ4Z",
96 associatedDomains: [
97 `applinks:${variant.relyingParty}`,
98 `webcredentials:${variant.relyingParty}`,
99 ],
100 infoPlist: {
101 NSAppTransportSecurity: {
102 NSAllowsArbitraryLoads: true,
103 },
104 NSLocalNetworkUsageDescription:
105 "Allow T3 Code to connect to T3 Code servers on your local network or tailnet.",
106 ITSAppUsesNonExemptEncryption: false,
107 },
108 },
109 android: {
110 icon: "./assets/icon.png",
111 package: variant.androidPackage,
112 adaptiveIcon: {
113 backgroundColor: "#E6F4FE",
114 foregroundImage: "./assets/android-icon-foreground.png",
115 backgroundImage: "./assets/android-icon-background.png",
116 monochromeImage: "./assets/android-icon-monochrome.png",
117 },
118 predictiveBackGestureEnabled: false,
119 },
120 web: {
121 favicon: "./assets/favicon.png",
122 },
123 plugins: [
124 "expo-font",
125 "expo-secure-store",
126 ["@clerk/expo", { theme: "./clerk-theme.json" }],
127 "expo-web-browser",
128 [
129 "expo-camera",
130 {
131 cameraPermission: "Allow T3 Code to access your camera so you can scan pairing QR codes.",
132 barcodeScannerEnabled: true,
133 },
134 ],
135 [
136 "expo-splash-screen",
137 {
138 image: variant.splashIcon,
139 resizeMode: "contain",
140 backgroundColor: "#ffffff",
141 imageWidth: 220,
142 dark: {
143 image: variant.splashIcon,
144 backgroundColor: "#0a0a0a",
145 },
146 },
147 ],
148 [
149 "expo-build-properties",
150 {
151 ios: {
152 deploymentTarget: "18.0",
153 // AppCheckCore 11.3+ includes Swift and needs module maps for these Objective-C dependencies.
154 extraPods: [
155 { name: "GoogleUtilities", modular_headers: true },
156 { name: "RecaptchaInterop", modular_headers: true },
157 ],
158 },
159 },
160 ],
161 "./plugins/withIosCocoaPodsUuidCache.cjs",
162 // Must be listed BEFORE expo-widgets: same-type mods run last-registered-
163 // first, so registering earlier makes this plugin's mods run AFTER
164 // expo-widgets' — its dangerous mod wipes ios/ExpoWidgetsTarget/ (which
165 // would delete the asset catalog) and its xcodeproj mod creates the widget
166 // target (which must exist before the compile phase can be attached).
167 "./plugins/withWidgetLogoAsset.cjs",
168 [
169 "expo-widgets",
170 {
171 bundleIdentifier: `${variant.iosBundleIdentifier}.widgets`,
172 groupIdentifier: `group.${variant.iosBundleIdentifier}`,
173 enablePushNotifications: true,
174 // Agent activity can update many times an hour; without the
175 // frequent-updates entitlement iOS throttles the update budget sooner.
176 frequentUpdates: true,
177 widgets: [
178 {
179 name: "AgentActivity",
180 displayName: "Agent Activity",
181 description: "Shows the current state of active T3 Code agents.",
182 supportedFamilies: ["systemSmall", "systemMedium", "accessoryRectangular"],
183 },
184 ],
185 },
186 ],
187 "./plugins/withIosSceneLifecycle.cjs",
188 "./plugins/withAndroidCleartextTraffic.cjs",
189 ],
190 extra: {
191 appVariant: APP_VARIANT,
192 relay: {
193 url: repoEnv.T3CODE_RELAY_URL ?? null,
194 },
195 clerk: {
196 publishableKey: repoEnv.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY ?? null,
197 jwtTemplate: repoEnv.EXPO_PUBLIC_CLERK_JWT_TEMPLATE ?? null,
198 },
199 // Native Google sign-in credentials. @clerk/expo reads these from `extra`
200 // under their exact env-var names (not nested), and its config plugin reads
201 // the iOS URL scheme at prebuild to register it in Info.plist.
202 // Unset values must be omitted (not null): the public manifest serializes
203 // null to {}, which is truthy and would defeat Clerk's fallback checks.
204 EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID: repoEnv.EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID,
205 EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID: repoEnv.EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID,
206 EXPO_PUBLIC_CLERK_GOOGLE_ANDROID_CLIENT_ID: repoEnv.EXPO_PUBLIC_CLERK_GOOGLE_ANDROID_CLIENT_ID,
207 EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME: repoEnv.EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME,
208 observability: {
209 tracesUrl: repoEnv.EXPO_PUBLIC_OTLP_TRACES_URL ?? "https://api.axiom.co/v1/traces",
210 tracesDataset: repoEnv.EXPO_PUBLIC_OTLP_TRACES_DATASET ?? null,
211 tracesToken: repoEnv.EXPO_PUBLIC_OTLP_TRACES_TOKEN ?? null,
212 },
213 eas: {
214 projectId: "d763fcb8-d37c-41ea-a773-b54a0ab4a454",
215 },
216 },
217 owner: "pingdotgg",
218};
219
220export default config;