Skip to content

Commit 3475b7d

Browse files
committed
Testing.
1 parent 1b5828f commit 3475b7d

File tree

4 files changed

+3518
-695
lines changed

4 files changed

+3518
-695
lines changed

demos/react-native-web-supabase-todolist/app.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ const config: ExpoConfig = {
3838
},
3939
package: 'com.powersync.example'
4040
},
41+
4142
web: {
43+
bundler: 'metro',
44+
output: 'static',
4245
favicon: './assets/favicon.png'
4346
},
4447
extra: {
@@ -58,7 +61,7 @@ const config: ExpoConfig = {
5861
'expo-build-properties',
5962
{
6063
ios: {
61-
deploymentTarget: '13.4',
64+
deploymentTarget: '15.1',
6265
// TODO: New architecture is currently not yet supported by @journeyapps/react-native-quick-sqlite
6366
newArchEnabled: false
6467
},

demos/react-native-web-supabase-todolist/library/powersync/system.ts

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import '@azure/core-asynciterator-polyfill';
22

33
import React from 'react';
44
import { PowerSyncDatabase as PowerSyncDatabaseNative } from '@powersync/react-native';
5-
import { PowerSyncDatabase as PowerSyncDatabaseWeb, WASQLiteOpenFactory } from '@powersync/web';
65
import { AbstractPowerSyncDatabase } from '@powersync/common';
76
import { SupabaseStorageAdapter } from '../storage/SupabaseStorageAdapter';
87
import { type AttachmentRecord } from '@powersync/attachments';
@@ -15,6 +14,9 @@ import { PhotoAttachmentQueue } from './PhotoAttachmentQueue';
1514

1615
Logger.useDefaults();
1716

17+
// const powerSyncReactNative = typeof window !== 'undefined' ? require('@powersync/web') : undefined;
18+
const powerSyncWeb = typeof window !== 'undefined' ? require('@powersync/web') : undefined;
19+
1820
export class System {
1921
kvStorage: KVStorage;
2022
storage: SupabaseStorageAdapter;
@@ -34,42 +36,44 @@ export class System {
3436
}
3537
});
3638
} else {
37-
const factory = new WASQLiteOpenFactory({
38-
dbFilename: 'sqlite.db',
39-
40-
// You can specify a path to the db worker
41-
worker: '/@powersync/worker/WASQLiteDB.umd.js'
39+
if (powerSyncWeb) {
40+
const factory = new powerSyncWeb.WASQLiteOpenFactory({
41+
dbFilename: 'sqlite.db',
4242

43-
// Or provide a factory function to create the worker.
44-
// The worker name should be unique for the database filename to avoid conflicts if multiple clients with different databases are present.
45-
// worker: (options) => {
46-
// if (options?.flags?.enableMultiTabs) {
47-
// return new SharedWorker(`/@powersync/worker/WASQLiteDB.umd.js`, {
48-
// name: `shared-DB-worker-${options?.dbFilename}`
49-
// });
50-
// } else {
51-
// return new Worker(`/@powersync/worker/WASQLiteDB.umd.js`, {
52-
// name: `DB-worker-${options?.dbFilename}`
53-
// });
54-
// }
55-
// }
56-
});
57-
this.powersync = new PowerSyncDatabaseWeb({
58-
schema: AppSchema,
59-
database: factory,
60-
sync: {
61-
// You can specify a path to the sync worker
62-
worker: '/@powersync/worker/SharedSyncImplementation.umd.js'
43+
// You can specify a path to the db worker
44+
worker: '/@powersync/worker/WASQLiteDB.umd.js'
6345

6446
// Or provide a factory function to create the worker.
6547
// The worker name should be unique for the database filename to avoid conflicts if multiple clients with different databases are present.
6648
// worker: (options) => {
67-
// return new SharedWorker(`/@powersync/worker/SharedSyncImplementation.umd.js`, {
68-
// name: `shared-sync-${options?.dbFilename}`
69-
// });
49+
// if (options?.flags?.enableMultiTabs) {
50+
// return new SharedWorker(`/@powersync/worker/WASQLiteDB.umd.js`, {
51+
// name: `shared-DB-worker-${options?.dbFilename}`
52+
// });
53+
// } else {
54+
// return new Worker(`/@powersync/worker/WASQLiteDB.umd.js`, {
55+
// name: `DB-worker-${options?.dbFilename}`
56+
// });
57+
// }
7058
// }
71-
}
72-
});
59+
});
60+
this.powersync = new powerSyncWeb.PowerSyncDatabase({
61+
schema: AppSchema,
62+
database: factory,
63+
sync: {
64+
// You can specify a path to the sync worker
65+
worker: '/@powersync/worker/SharedSyncImplementation.umd.js'
66+
67+
// Or provide a factory function to create the worker.
68+
// The worker name should be unique for the database filename to avoid conflicts if multiple clients with different databases are present.
69+
// worker: (options) => {
70+
// return new SharedWorker(`/@powersync/worker/SharedSyncImplementation.umd.js`, {
71+
// name: `shared-sync-${options?.dbFilename}`
72+
// });
73+
// }
74+
}
75+
});
76+
}
7377
}
7478

7579
if (AppConfig.supabaseBucket) {

demos/react-native-web-supabase-todolist/package.json

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,57 +11,57 @@
1111
},
1212
"dependencies": {
1313
"@azure/core-asynciterator-polyfill": "^1.0.2",
14-
"@expo/metro-runtime": "^3.2.1",
15-
"@expo/vector-icons": "^14.0.0",
16-
"@journeyapps/react-native-quick-sqlite": "^2.4.2",
17-
"@powersync/attachments": "workspace:*",
18-
"@powersync/common": "workspace:*",
19-
"@powersync/react": "workspace:*",
20-
"@powersync/react-native": "workspace:*",
21-
"@powersync/web": "workspace:*",
14+
"@expo/metro-runtime": "^4.0.1",
15+
"@expo/vector-icons": "^14.0.2",
16+
"@journeyapps/react-native-quick-sqlite": "^2.4.0",
17+
"@journeyapps/wa-sqlite": "^1.2.0",
18+
"@powersync/attachments": "latest",
19+
"@powersync/react": "^1.5.1",
20+
"@powersync/react-native": "^1.17.0",
21+
"@powersync/web": "^1.14.0",
2222
"@react-native-async-storage/async-storage": "1.23.1",
23-
"@react-native-community/masked-view": "^0.1.11",
23+
"@react-navigation/bottom-tabs": "^7.2.0",
2424
"@react-navigation/drawer": "^6.6.3",
25-
"@react-navigation/native": "^6.0.0",
26-
"@supabase/supabase-js": "^2.33.1",
25+
"@react-navigation/native": "^7.0.14",
26+
"@supabase/supabase-js": "^2.45.4",
27+
"@tanstack/react-query": "^5.66.0",
2728
"base64-arraybuffer": "^1.0.2",
28-
"expo": "51.0.27",
29-
"expo-build-properties": "~0.12.5",
30-
"expo-camera": "~15.0.10",
31-
"expo-constants": "~16.0.2",
32-
"expo-crypto": "~13.0.2",
33-
"expo-file-system": "^17.0.1",
34-
"expo-linking": "~6.3.1",
35-
"expo-router": "3.5.21",
36-
"expo-secure-store": "~13.0.1",
37-
"expo-splash-screen": "~0.27.4",
38-
"expo-status-bar": "~1.12.1",
39-
"js-logger": "^1.6.1",
40-
"lodash": "^4.17.21",
41-
"metro": "~0.80.8",
42-
"react": "18.2.0",
43-
"react-native": "0.74.5",
29+
"expo": "~52.0.33",
30+
"expo-blur": "~14.0.3",
31+
"expo-camera": "~16.0.18",
32+
"expo-constants": "~17.0.5",
33+
"expo-crypto": "~14.0.2",
34+
"expo-font": "~13.0.3",
35+
"expo-haptics": "~14.0.1",
36+
"expo-linking": "~7.0.5",
37+
"expo-router": "~4.0.17",
38+
"expo-secure-store": "^14.0.1",
39+
"expo-splash-screen": "~0.29.21",
40+
"expo-status-bar": "~2.0.1",
41+
"expo-symbols": "~0.2.2",
42+
"expo-system-ui": "~4.0.8",
43+
"expo-web-browser": "~14.0.2",
44+
"react": "18.3.1",
45+
"react-dom": "18.3.1",
46+
"react-native": "0.76.7",
4447
"react-native-elements": "^3.4.3",
45-
"react-native-encrypted-storage": "^4.0.3",
46-
"react-native-gesture-handler": "~2.16.2",
47-
"react-native-prompt-android": "^1.1.0",
48-
"react-native-reanimated": "~3.10.0",
49-
"react-native-reanimated-table": "^0.0.2",
50-
"react-native-safe-area-context": "4.10.5",
51-
"react-native-safe-area-view": "^1.1.1",
52-
"react-native-screens": "~3.31.1",
53-
"react-native-vector-icons": "^10.0.0",
54-
"react-native-web": "^0.19.12",
55-
"react-navigation-stack": "^2.10.4"
48+
"react-native-gesture-handler": "~2.20.2",
49+
"react-native-logs": "^5.3.0",
50+
"react-native-reanimated": "~3.16.1",
51+
"react-native-safe-area-context": "4.12.0",
52+
"react-native-screens": "~4.4.0",
53+
"react-native-web": "~0.19.13",
54+
"react-native-webview": "13.12.5",
55+
"zod": "^3.24.2"
5656
},
5757
"devDependencies": {
58-
"@babel/core": "^7.24.5",
59-
"@babel/plugin-transform-async-generator-functions": "^7.23.9",
60-
"@babel/preset-env": "^7.23.9",
61-
"@types/lodash": "^4.14.202",
62-
"@types/react": "~18.2.57",
63-
"babel-preset-expo": "^11.0.5",
64-
"prettier": "^3.2.5",
58+
"@babel/core": "^7.25.2",
59+
"@types/jest": "^29.5.12",
60+
"@types/react": "~18.3.12",
61+
"@types/react-test-renderer": "^18.3.0",
62+
"jest": "^29.2.1",
63+
"jest-expo": "~52.0.3",
64+
"react-test-renderer": "18.3.1",
6565
"typescript": "^5.3.3"
6666
},
6767
"private": true

0 commit comments

Comments
 (0)