51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import type { ConfigContext, ExpoConfig } from "expo/config"
|
|
|
|
export default ({ config }: ConfigContext): ExpoConfig => {
|
|
const variant =
|
|
process.env.APP_VARIANT ?? process.env.EAS_BUILD_PROFILE ?? "production"
|
|
if (
|
|
variant !== "development" &&
|
|
variant !== "preview" &&
|
|
variant !== "production"
|
|
) {
|
|
throw new Error(`Unsupported APP_VARIANT: ${variant}`)
|
|
}
|
|
|
|
const suffix = variant === "production" ? "" : `.${variant}`
|
|
const iconSuffix = variant === "production" ? "" : `-${variant}`
|
|
const nameSuffix =
|
|
variant === "development"
|
|
? " (Development)"
|
|
: variant === "preview"
|
|
? " (Preview)"
|
|
: ""
|
|
const composer = {
|
|
development: "oTunes Dev",
|
|
preview: "oTunes Preview",
|
|
production: "oTunes",
|
|
}[variant]
|
|
|
|
return {
|
|
...config,
|
|
name: `${config.name}${nameSuffix}`,
|
|
slug: config.slug!,
|
|
scheme: variant === "production" ? "otunes" : `otunes-${variant}`,
|
|
icon: `./assets/icon${iconSuffix}.png`,
|
|
ios: {
|
|
...config.ios,
|
|
bundleIdentifier: `${config.ios!.bundleIdentifier}${suffix}`,
|
|
icon: `./assets/${composer}.icon`,
|
|
},
|
|
android: {
|
|
...config.android,
|
|
package: `${config.android!.package}${suffix}`,
|
|
icon: `./assets/android-icon${iconSuffix}.png`,
|
|
adaptiveIcon: {
|
|
monochromeImage: "./assets/android-icon-monochrome.png",
|
|
foregroundImage: `./assets/android-icon-foreground${iconSuffix}.png`,
|
|
backgroundImage: `./assets/android-icon-background${iconSuffix}.png`,
|
|
},
|
|
},
|
|
}
|
|
}
|