feat(mobile): distinguish app identities by build profile

This commit is contained in:
joshuafhiggins committed 2026-11-01 17:31:20 -05:00 Verified
1 parent 1d04d0d146
commit 902ed09764
3 files changed
+65

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
# Mobile build variants
EAS profiles set `APP_VARIANT` to select the app identity in `app.config.ts`.
Both iOS bundle identifiers and Android package names use these values:
| Profile | App name | Identifier |
| --- | --- | --- |
| development | oTunes (Development) | com.abunchofknowitalls.otunes.development |
| preview | oTunes (Preview) | com.abunchofknowitalls.otunes.preview |
| production | oTunes | com.abunchofknowitalls.otunes |
Build with `eas build --profile development`, `--profile preview`, or
`--profile production` from this directory.
For local builds and Metro, select the same variant explicitly:
```sh
APP_VARIANT=development pnpm ios
APP_VARIANT=development pnpm android
APP_VARIANT=development pnpm start
```
An unset `APP_VARIANT` keeps the production identity. Unknown variants fail
configuration. URL schemes are `otunes-development`, `otunes-preview`, and
`otunes` respectively, allowing the apps to be installed together.
+31
View File
@@ -0,0 +1,31 @@
import type { ConfigContext, ExpoConfig } from "expo/config"
export default ({ config }: ConfigContext): ExpoConfig => {
const variant = process.env.APP_VARIANT ?? "production"
if (!["development", "preview", "production"].includes(variant)) {
throw new Error(`Unsupported APP_VARIANT: ${variant}`)
}
const suffix = variant === "production" ? "" : `.${variant}`
const nameSuffix =
variant === "development"
? " (Development)"
: variant === "preview"
? " (Preview)"
: ""
return {
...config,
name: `${config.name}${nameSuffix}`,
slug: config.slug!,
scheme: variant === "production" ? "otunes" : `otunes-${variant}`,
ios: {
...config.ios,
bundleIdentifier: `${config.ios!.bundleIdentifier}${suffix}`,
},
android: {
...config.android,
package: `${config.android!.package}${suffix}`,
},
}
}
+9
View File
@@ -5,13 +5,22 @@
},
"build": {
"development": {
"env": {
"APP_VARIANT": "development"
},
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"env": {
"APP_VARIANT": "preview"
},
"distribution": "internal"
},
"production": {
"env": {
"APP_VARIANT": "production"
},
"autoIncrement": true
}
},