|
1 | | -import { ExpoConfig } from 'expo/config'; |
| 1 | +import { ConfigContext, ExpoConfig } from 'expo/config'; |
2 | 2 |
|
3 | | -const EXPO_PROJECT_ID = 'af6ae74c-f04d-497a-9733-b2b7539f77c5'; |
| 3 | +// Replace these with your EAS project ID and project slug. |
| 4 | +// You can find them at https://expo.dev/accounts/[account]/projects/[project]. |
| 5 | +const EAS_PROJECT_ID = 'af6ae74c-f04d-497a-9733-b2b7539f77c5'; |
| 6 | +const PROJECT_SLUG = 'start-ui-native-v9iizxkbojzedvpfkfzcq'; |
| 7 | +const OWNER = 'bearstudio'; |
4 | 8 |
|
5 | | -const appPrefix = |
6 | | - process.env.EXPO_PUBLIC_ENVIRONMENT === 'storybook' ? 'Storybook β’ ' : ''; |
| 9 | +// App production config |
| 10 | +const APP_NAME = 'Start UI [native]'; |
| 11 | +const BUNDLE_IDENTIFIER = 'com.bearstudio.startuinative'; |
| 12 | +const PACKAGE_NAME = 'com.bearstudio.startuinative'; |
| 13 | +const ICON = './src/assets/images/icon.png'; |
| 14 | +const ADAPTIVE_ICON_FOREGROUND = |
| 15 | + './src/assets/images/android-icon-foreground.png'; |
| 16 | +const ADAPTIVE_ICON_MONOCHROME = |
| 17 | + './src/assets/images/android-icon-monochrome.png'; |
| 18 | +const SCHEME = 'start-ui-native'; |
7 | 19 |
|
8 | | -export default { |
9 | | - name: appPrefix + 'Start UI [native]', |
10 | | - slug: 'start-ui-native-v9iizxkbojzedvpfkfzcq', |
11 | | - scheme: 'start-ui-native', |
12 | | - owner: 'bearstudio', |
13 | | - version: '1.0.0', |
14 | | - runtimeVersion: { |
15 | | - policy: 'appVersion', |
16 | | - }, |
17 | | - platforms: ['android', 'ios'], |
18 | | - orientation: 'default', |
19 | | - icon: './src/assets/images/icon.png', |
20 | | - userInterfaceStyle: 'automatic', |
21 | | - backgroundColor: '#FFFFFF', |
22 | | - experiments: { |
23 | | - typedRoutes: true, |
24 | | - reactCompiler: true, |
25 | | - tsconfigPaths: true, |
26 | | - }, |
27 | | - ios: { |
28 | | - bundleIdentifier: 'com.bearstudio.startuinative', |
29 | | - supportsTablet: true, |
30 | | - infoPlist: { |
31 | | - ITSAppUsesNonExemptEncryption: false, |
| 20 | +const expoConfig = ({ config }: ConfigContext) => { |
| 21 | + const { name, bundleIdentifier, icon, adaptiveIcon, packageName, scheme } = |
| 22 | + getDynamicAppConfig(process.env.APP_ENV); |
| 23 | + |
| 24 | + return { |
| 25 | + ...config, |
| 26 | + name, |
| 27 | + slug: PROJECT_SLUG, |
| 28 | + owner: OWNER, |
| 29 | + |
| 30 | + scheme, |
| 31 | + version: '1.0.0', |
| 32 | + runtimeVersion: { |
| 33 | + policy: 'appVersion', |
32 | 34 | }, |
33 | | - // appStoreUrl: 'https://apps.apple.com/fr/app/bearstudio/startuinative', |
34 | | - }, |
35 | | - android: { |
36 | | - package: 'com.bearstudio.startuinative', |
37 | | - adaptiveIcon: { |
38 | | - backgroundColor: '#FFFFFF', |
39 | | - foregroundImage: './src/assets/images/android-icon-foreground.png', |
40 | | - monochromeImage: './src/assets/images/android-icon-monochrome.png', |
| 35 | + platforms: ['android', 'ios'], |
| 36 | + orientation: 'default', |
| 37 | + icon, |
| 38 | + userInterfaceStyle: 'automatic', |
| 39 | + backgroundColor: '#FFFFFF', |
| 40 | + experiments: { |
| 41 | + typedRoutes: true, |
| 42 | + reactCompiler: true, |
| 43 | + tsconfigPaths: true, |
41 | 44 | }, |
42 | | - edgeToEdgeEnabled: true, |
43 | | - // playStoreUrl: |
44 | | - // 'https://play.google.com/store/apps/details?id=com.bearstudio.startuinative', |
45 | | - }, |
46 | | - plugins: [ |
47 | | - 'expo-router', |
48 | | - [ |
49 | | - 'expo-splash-screen', |
50 | | - { |
51 | | - image: './src/assets/images/splash-icon-light.png', |
52 | | - imageWidth: 200, |
53 | | - resizeMode: 'contain', |
54 | | - backgroundColor: '#ffffff', |
55 | | - dark: { |
56 | | - image: './src/assets/images/splash-icon-dark.png', |
57 | | - backgroundColor: '#000000', |
58 | | - }, |
| 45 | + ios: { |
| 46 | + bundleIdentifier, |
| 47 | + supportsTablet: true, |
| 48 | + infoPlist: { |
| 49 | + ITSAppUsesNonExemptEncryption: false, |
| 50 | + }, |
| 51 | + // appStoreUrl: 'https://apps.apple.com/fr/app/bearstudio/startuinative', |
| 52 | + }, |
| 53 | + android: { |
| 54 | + package: packageName, |
| 55 | + adaptiveIcon: { |
| 56 | + ...adaptiveIcon, |
| 57 | + backgroundColor: '#FFFFFF', |
59 | 58 | }, |
| 59 | + edgeToEdgeEnabled: true, |
| 60 | + // playStoreUrl: |
| 61 | + // 'https://play.google.com/store/apps/details?id=com.bearstudio.startuinative', |
| 62 | + }, |
| 63 | + plugins: [ |
| 64 | + 'expo-router', |
| 65 | + [ |
| 66 | + 'expo-splash-screen', |
| 67 | + { |
| 68 | + image: './src/assets/images/splash-icon-light.png', |
| 69 | + imageWidth: 200, |
| 70 | + resizeMode: 'contain', |
| 71 | + backgroundColor: '#ffffff', |
| 72 | + dark: { |
| 73 | + image: './src/assets/images/splash-icon-dark.png', |
| 74 | + backgroundColor: '#000000', |
| 75 | + }, |
| 76 | + }, |
| 77 | + ], |
| 78 | + 'expo-web-browser', |
| 79 | + 'expo-secure-store', |
| 80 | + 'expo-localization', |
| 81 | + 'expo-font', |
60 | 82 | ], |
61 | | - 'expo-web-browser', |
62 | | - 'expo-secure-store', |
63 | | - 'expo-localization', |
64 | | - 'expo-font', |
65 | | - ], |
66 | | - githubUrl: 'https://github.com/bearstudio/start-ui-native', |
67 | | - updates: { |
68 | | - url: `https://u.expo.dev/${EXPO_PROJECT_ID}`, |
69 | | - }, |
70 | | - extra: { |
71 | | - isStorybook: process.env.EXPO_PUBLIC_ENVIRONMENT === 'storybook', |
72 | | - eas: { |
73 | | - projectId: EXPO_PROJECT_ID, |
| 83 | + githubUrl: 'https://github.com/bearstudio/start-ui-native', |
| 84 | + updates: { |
| 85 | + url: `https://u.expo.dev/${EAS_PROJECT_ID}`, |
| 86 | + }, |
| 87 | + extra: { |
| 88 | + isStorybook: process.env.EXPO_PUBLIC_ENVIRONMENT === 'storybook', |
| 89 | + eas: { |
| 90 | + projectId: EAS_PROJECT_ID, |
| 91 | + }, |
74 | 92 | }, |
75 | | - }, |
76 | | -} as const satisfies ExpoConfig; |
| 93 | + } as const satisfies ExpoConfig; |
| 94 | +}; |
| 95 | + |
| 96 | +export const getDynamicAppConfig = ( |
| 97 | + environment: 'development' | 'preview' | 'production' |
| 98 | +) => { |
| 99 | + switch (environment) { |
| 100 | + case 'development': |
| 101 | + return { |
| 102 | + name: `${APP_NAME} β’ DEV`, |
| 103 | + bundleIdentifier: `${BUNDLE_IDENTIFIER}.dev`, |
| 104 | + packageName: `${PACKAGE_NAME}.dev`, |
| 105 | + icon: ICON, |
| 106 | + adaptiveIcon: { |
| 107 | + foregroundImage: ADAPTIVE_ICON_FOREGROUND, |
| 108 | + monochromeImage: ADAPTIVE_ICON_MONOCHROME, |
| 109 | + }, |
| 110 | + scheme: `${SCHEME}-dev`, |
| 111 | + }; |
| 112 | + |
| 113 | + case 'preview': |
| 114 | + return { |
| 115 | + name: `${APP_NAME} β’ PREVIEW`, |
| 116 | + bundleIdentifier: `${BUNDLE_IDENTIFIER}.preview`, |
| 117 | + packageName: `${PACKAGE_NAME}.preview`, |
| 118 | + icon: ICON, |
| 119 | + adaptiveIcon: { |
| 120 | + foregroundImage: ADAPTIVE_ICON_FOREGROUND, |
| 121 | + monochromeImage: ADAPTIVE_ICON_MONOCHROME, |
| 122 | + }, |
| 123 | + scheme: `${SCHEME}-preview`, |
| 124 | + }; |
| 125 | + |
| 126 | + case 'production': |
| 127 | + default: |
| 128 | + return { |
| 129 | + name: APP_NAME, |
| 130 | + bundleIdentifier: BUNDLE_IDENTIFIER, |
| 131 | + packageName: PACKAGE_NAME, |
| 132 | + icon: ICON, |
| 133 | + adaptiveIcon: { |
| 134 | + foregroundImage: ADAPTIVE_ICON_FOREGROUND, |
| 135 | + monochromeImage: ADAPTIVE_ICON_MONOCHROME, |
| 136 | + }, |
| 137 | + scheme: SCHEME, |
| 138 | + }; |
| 139 | + } |
| 140 | +}; |
| 141 | + |
| 142 | +export default expoConfig; |
0 commit comments