Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure app variants #1253

Draft
wants to merge 2 commits into
base: andrew_testing
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions apps/expo/app.config.js
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
9 changes: 9 additions & 0 deletions apps/expo/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"development": {
"developmentClient": true,
"distribution": "internal",
"env": {
"APP_VARIANT": "development"
},
"android": {
"gradleCommand": ":app:assembleDebug"
},
Expand All @@ -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"
}
Expand Down
8 changes: 4 additions & 4 deletions apps/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading