From 902ed0976462ec3806a01acd4c64d5e7cdd9d2a7 Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Fri, 30 Oct 2026 14:20:17 -0400 Subject: [PATCH] feat(mobile): distinguish app identities by build profile --- apps/mobile/README.md | 25 +++++++++++++++++++++++++ apps/mobile/app.config.ts | 31 +++++++++++++++++++++++++++++++ apps/mobile/eas.json | 9 +++++++++ 3 files changed, 65 insertions(+) create mode 100644 apps/mobile/README.md create mode 100644 apps/mobile/app.config.ts diff --git a/apps/mobile/README.md b/apps/mobile/README.md new file mode 100644 index 0000000..000f86b --- /dev/null +++ b/apps/mobile/README.md @@ -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. diff --git a/apps/mobile/app.config.ts b/apps/mobile/app.config.ts new file mode 100644 index 0000000..b488362 --- /dev/null +++ b/apps/mobile/app.config.ts @@ -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}`, + }, + } +} diff --git a/apps/mobile/eas.json b/apps/mobile/eas.json index 741ab79..69e0242 100644 --- a/apps/mobile/eas.json +++ b/apps/mobile/eas.json @@ -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 } },