diff --git a/apps/expo/app.config.js b/apps/expo/app.config.js index f7c19c2c7..93ac5e984 100644 --- a/apps/expo/app.config.js +++ b/apps/expo/app.config.js @@ -1,4 +1,28 @@ +function getVariantConfig() { + switch (process.env.APP_VARIANT) { + case 'development': + return { + appName: 'Packrat (Dev)', + id: 'com.andrewbierman.packrat.development', + }; + case 'preview': + return { + appName: 'Packrat (Preview)', + id: 'com.andrewbierman.packrat.preview', + }; + case 'production': + return { appName: 'Packrat', id: 'com.andrewbierman.packrat' }; + default: + throw new Error('APP_VARIANT env not set'); + } +} + module.exports = ({ config }) => { + const { appName, id } = getVariantConfig(); + config.name = appName; + config.ios.bundleIdentifier = id; + config.android.package = id; + return { ...config, plugins: config.plugins.map((i) => { diff --git a/apps/expo/eas.json b/apps/expo/eas.json index a3b2fe236..0a760912d 100644 --- a/apps/expo/eas.json +++ b/apps/expo/eas.json @@ -7,6 +7,9 @@ "development": { "developmentClient": true, "distribution": "internal", + "env": { + "APP_VARIANT": "development" + }, "android": { "gradleCommand": ":app:assembleDebug" }, @@ -17,12 +20,18 @@ }, "preview": { "distribution": "internal", + "env": { + "APP_VARIANT": "preview" + }, "ios": { "resourceClass": "m-medium" } }, "production": { "autoIncrement": true, + "env": { + "APP_VARIANT": "production" + }, "ios": { "resourceClass": "m-medium" } diff --git a/apps/expo/package.json b/apps/expo/package.json index ac560ee71..e9add1146 100644 --- a/apps/expo/package.json +++ b/apps/expo/package.json @@ -26,11 +26,11 @@ "setup:keyreplace": "node setup.js", "setup:move": "yarn move:gradle && yarn move:pod", "setup": "yarn setup:copy && yarn setup:keyreplace && yarn setup:move", - "start-native": "TAMAGUI_TARGET=native npx expo start -c -d", - "start-web": "TAMAGUI_TARGET=web npx expo start -c", - "start": "EXPO_USE_METRO_WORKSPACE_ROOT=1 npx expo start --dev-client -c -d", + "start-native": "TAMAGUI_TARGET=native APP_VARIANT=development npx expo start -c -d", + "start-web": "TAMAGUI_TARGET=web APP_VARIANT=development npx expo start -c", + "start": "EXPO_USE_METRO_WORKSPACE_ROOT=1 APP_VARIANT=development npx expo start --dev-client -c -d", "test": "echo \"No tests yet\"", - "web": "npx expo start --web" + "web": "APP_VARIANT=development npx expo start --web" }, "dependencies": { "@babel/runtime": "^7.21.0",