Skip to content

Commit adead82

Browse files
Christiaan LandmanChristiaan Landman
authored andcommitted
chore: updated rn-sb-demo to use expo environment variables
Ensured EAS works with monorepo's packages updated lock file
1 parent 4d65c56 commit adead82

File tree

16 files changed

+250
-98
lines changed

16 files changed

+250
-98
lines changed

app.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"expo": {}
3+
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# Replace the credentials below with you Supabase, PowerSync and Expo project details.
1+
# Copy this template: `cp .env.template .env`
2+
# Edit .env and enter your Supabase and PowerSync project details.
23
EXPO_PUBLIC_SUPABASE_URL=https://foo.supabase.co
34
EXPO_PUBLIC_SUPABASE_ANON_KEY=foo
45
EXPO_PUBLIC_POWERSYNC_URL=https://foo.powersync.journeyapps.com
5-
EXPO_PUBLIC_EAS_PROJECT_ID=foo
6+
EXPO_PUBLIC_EAS_PROJECT_ID=foo # Optional. Only required when using EAS.

demos/react-native-supabase-group-chat/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ web-build/
1616
# Temporary files created by Metro to check the health of the file watcher
1717
.metro-health-check*
1818

19-
# .env
19+
# local env files
20+
.env*.local
21+
2022
*.ipa
2123
*.tar.gz
2224
.tamagui
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Edit and enter your Supabase and PowerSync project details.
2+
EXPO_PUBLIC_SUPABASE_URL=https://foo.supabase.co
3+
EXPO_PUBLIC_SUPABASE_ANON_KEY=foo
4+
EXPO_PUBLIC_SUPABASE_BUCKET= // Optional. Only required when syncing attachments and using Supabase Storage. See packages/powersync-attachments.
5+
EXPO_PUBLIC_POWERSYNC_URL=https://foo.powersync.journeyapps.com
6+
EXPO_PUBLIC_EAS_PROJECT_ID=foo # Optional. Only required when using EAS.

demos/react-native-supabase-todolist/.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
22

3-
# Credentials
4-
library/supabase/AppConfig.ts
5-
63
# dependencies
74
node_modules/
85

@@ -31,7 +28,6 @@ npm-debug.*
3128

3229
# local env files
3330
.env*.local
34-
.env
3531

3632
# typescript
3733
*.tsbuildinfo

demos/react-native-supabase-todolist/README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,7 @@ bucket_definitions:
3636
```
3737
3838
## Configure The App
39-
40-
Copy the `AppConfig.template.ts` to a usable file
41-
42-
```bash
43-
cp library/supabase/AppConfig.template.ts library/supabase/AppConfig.ts
44-
```
45-
46-
Insert the necessary credentials.
39+
Replace the necessary credentials in the [.env](./.env) file.
4740
4841
## Run the App
4942
@@ -64,3 +57,16 @@ Run on Android
6457
```sh
6558
pnpm android
6659
```
60+
61+
## EAS Setup
62+
To use EAS for builds you need to ensure that your [eas.json](./eas.json) file is configured.
63+
This may lead to some duplication of variables between `.env` files and `eas.json` build profiles but makes it easier to see what variables will be applied across all environments. Read more on this [here](https://docs.expo.dev/build-reference/variables/#can-eas-build-use-env-files).
64+
65+
66+
## Here are some helpful links:
67+
68+
- [PowerSync Website](https://www.powersync.com/)
69+
- [PowerSync Docs](https://docs.powersync.com/)
70+
- [PowerSync React Native Client SDK](https://github.com/journeyapps/powersync-js/tree/main/packages/powersync-sdk-react-native)
71+
- [Supabase Docs](https://supabase.com/docs)
72+
- [Expo Docs](https://docs.expo.dev/)
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { type ExpoConfig } from "expo/config";
2+
3+
const projectId = process.env.EXPO_PUBLIC_EAS_PROJECT_ID;
4+
5+
const config: ExpoConfig = {
6+
name: 'powersync-example',
7+
slug: 'powersync-example',
8+
version: '1.0.0',
9+
orientation: 'portrait',
10+
icon: './assets/icon.png',
11+
userInterfaceStyle: 'light',
12+
scheme: 'powersync',
13+
splash: {
14+
image: './assets/splash.png',
15+
resizeMode: 'contain',
16+
backgroundColor: '#ffffff',
17+
},
18+
updates: {
19+
url: `https://u.expo.dev/${projectId}`,
20+
},
21+
assetBundlePatterns: ['**/*'],
22+
ios: {
23+
supportsTablet: true,
24+
bundleIdentifier: 'com.powersync.example',
25+
},
26+
android: {
27+
adaptiveIcon: {
28+
foregroundImage: './assets/adaptive-icon.png',
29+
backgroundColor: '#ffffff',
30+
},
31+
package: 'com.powersync.example',
32+
},
33+
web: {
34+
favicon: './assets/favicon.png',
35+
},
36+
extra: {
37+
eas: {
38+
projectId
39+
},
40+
},
41+
plugins: [
42+
'expo-router',
43+
[
44+
'expo-camera',
45+
{
46+
cameraPermission: 'Allow $(PRODUCT_NAME) to access your camera.',
47+
},
48+
],
49+
[
50+
'expo-build-properties',
51+
{
52+
ios: {
53+
deploymentTarget: '13.4',
54+
},
55+
},
56+
],
57+
'expo-secure-store',
58+
],
59+
};
60+
61+
export default config;

demos/react-native-supabase-todolist/app.json

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"cli": {
3+
"version": ">= 3.13.3",
4+
"promptToConfigurePushNotifications": false
5+
},
6+
"build": {
7+
"development": {
8+
"developmentClient": true,
9+
"distribution": "internal",
10+
"channel": "preview"
11+
},
12+
"preview": {
13+
"channel": "preview",
14+
"distribution": "internal"
15+
},
16+
"production": {
17+
"channel": "production",
18+
"env": {
19+
"EXPO_PUBLIC_SUPABASE_URL": "https://foo.supabase.co",
20+
"EXPO_PUBLIC_SUPABASE_ANON_KEY": "foo",
21+
"EXPO_PUBLIC_POWERSYNC_URL": "https://foo.powersync.journeyapps.com",
22+
"EXPO_PUBLIC_EAS_PROJECT_ID": "foo"
23+
}
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)