Skip to content

Commit 6353003

Browse files
committed
PWA support for Yjs demo.
1 parent d14f9d9 commit 6353003

File tree

4 files changed

+72
-37
lines changed

4 files changed

+72
-37
lines changed

demos/yjs-react-supabase-text-collab/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"style-loader": "^3.3.4",
6161
"supabase": "1.142.2",
6262
"vite": "^5.1.5",
63+
"vite-plugin-pwa": "^0.19.2",
6364
"vite-plugin-top-level-await": "^1.4.1",
6465
"vite-plugin-wasm": "^3.3.0"
6566
}

demos/yjs-react-supabase-text-collab/public/manifest.json

Lines changed: 0 additions & 31 deletions
This file was deleted.

demos/yjs-react-supabase-text-collab/vite.config.mts

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { fileURLToPath, URL } from 'url';
44

55
import { defineConfig } from 'vite';
66
import react from '@vitejs/plugin-react';
7+
import { VitePWA } from 'vite-plugin-pwa';
78

89
// https://vitejs.dev/config/
910
export default defineConfig({
@@ -26,7 +27,46 @@ export default defineConfig({
2627
exclude: ['@journeyapps/wa-sqlite', '@journeyapps/powersync-sdk-web'],
2728
include: ['object-hash', 'uuid', 'event-iterator', 'js-logger', 'lodash', 'can-ndjson-stream']
2829
},
29-
plugins: [wasm(), topLevelAwait(), react()],
30+
plugins: [
31+
wasm(),
32+
topLevelAwait(),
33+
react(),
34+
VitePWA({
35+
registerType: 'autoUpdate',
36+
includeAssets: ['favicon.ico'],
37+
manifest: {
38+
theme_color: '#c44eff',
39+
background_color: '#c44eff',
40+
display: 'standalone',
41+
scope: '/',
42+
start_url: '/',
43+
name: 'PowerSync Yjs Document Collaboration Demo',
44+
short_name: 'PowerSync Yjs',
45+
icons: [
46+
{
47+
src: '/icons/icon-192x192.png',
48+
sizes: '192x192',
49+
type: 'image/png'
50+
},
51+
{
52+
src: '/icons/icon-256x256.png',
53+
sizes: '256x256',
54+
type: 'image/png'
55+
},
56+
{
57+
src: '/icons/icon-384x384.png',
58+
sizes: '384x384',
59+
type: 'image/png'
60+
},
61+
{
62+
src: '/icons/icon-512x512.png',
63+
sizes: '512x512',
64+
type: 'image/png'
65+
}
66+
]
67+
}
68+
})
69+
],
3070
worker: {
3171
format: 'es',
3272
plugins: () => [wasm(), topLevelAwait()]

pnpm-lock.yaml

Lines changed: 30 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)