diff --git a/.changeset/chatty-news-appear.md b/.changeset/chatty-news-appear.md new file mode 100644 index 00000000..04748231 --- /dev/null +++ b/.changeset/chatty-news-appear.md @@ -0,0 +1,5 @@ +--- +"vue-supabase-todolist": patch +--- + +Added PWA support. diff --git a/demos/vue-supabase-todolist/.gitignore b/demos/vue-supabase-todolist/.gitignore index a731936f..48d6b341 100644 --- a/demos/vue-supabase-todolist/.gitignore +++ b/demos/vue-supabase-todolist/.gitignore @@ -25,3 +25,10 @@ components.d.ts *.njsproj *.sln *.sw? + +# PWA +**/public/workbox-*.js +**/public/sw.js +**/public/swe-worker-* +**/public/worker-*.js +**/public/fallback-*.js diff --git a/demos/vue-supabase-todolist/package.json b/demos/vue-supabase-todolist/package.json index 19982d75..6205dbd2 100644 --- a/demos/vue-supabase-todolist/package.json +++ b/demos/vue-supabase-todolist/package.json @@ -30,6 +30,7 @@ "unplugin-fonts": "^1.1.1", "unplugin-vue-components": "^0.26.0", "vite": "^5.2.0", + "vite-plugin-pwa": "^0.19.2", "vite-plugin-top-level-await": "^1.4.1", "vite-plugin-vuetify": "^2.0.3", "vite-plugin-wasm": "^3.3.0", diff --git a/demos/vue-supabase-todolist/public/powersync-logo.svg b/demos/vue-supabase-todolist/public/powersync-logo.svg new file mode 100644 index 00000000..32c83dd1 --- /dev/null +++ b/demos/vue-supabase-todolist/public/powersync-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/demos/vue-supabase-todolist/public/supabase-logo.png b/demos/vue-supabase-todolist/public/supabase-logo.png new file mode 100644 index 00000000..ff8c18e1 Binary files /dev/null and b/demos/vue-supabase-todolist/public/supabase-logo.png differ diff --git a/demos/vue-supabase-todolist/vite.config.ts b/demos/vue-supabase-todolist/vite.config.ts index af551a01..783516da 100644 --- a/demos/vue-supabase-todolist/vite.config.ts +++ b/demos/vue-supabase-todolist/vite.config.ts @@ -5,6 +5,7 @@ import Vue from '@vitejs/plugin-vue'; import ViteFonts from 'unplugin-fonts/vite'; import Components from 'unplugin-vue-components/vite'; import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'; +import { VitePWA } from 'vite-plugin-pwa'; // Utilities import { fileURLToPath, URL } from 'node:url'; @@ -29,6 +30,41 @@ export default defineConfig({ } ] } + }), + VitePWA({ + registerType: 'autoUpdate', + includeAssets: ['powersync-logo.svg', 'supabase-logo.png', 'favicon.ico'], + manifest: { + theme_color: '#c44eff', + background_color: '#c44eff', + display: 'standalone', + scope: '/', + start_url: '/', + name: 'PowerSync Vue Demo', + short_name: 'PowerSync Vue', + icons: [ + { + src: '/icons/icon-192x192.png', + sizes: '192x192', + type: 'image/png' + }, + { + src: '/icons/icon-256x256.png', + sizes: '256x256', + type: 'image/png' + }, + { + src: '/icons/icon-384x384.png', + sizes: '384x384', + type: 'image/png' + }, + { + src: '/icons/icon-512x512.png', + sizes: '512x512', + type: 'image/png' + } + ] + } }) ], define: { 'process.env': {} }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 580aab03..00973c8f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -880,13 +880,16 @@ importers: version: 1.1.1(vite@5.2.8) unplugin-vue-components: specifier: ^0.26.0 - version: 0.26.0(vue@3.4.21) + version: 0.26.0(rollup@2.79.1)(vue@3.4.21) vite: specifier: ^5.2.0 version: 5.2.8(sass@1.71.1) + vite-plugin-pwa: + specifier: ^0.19.2 + version: 0.19.2(vite@5.2.8)(workbox-build@7.0.0)(workbox-window@7.0.0) vite-plugin-top-level-await: specifier: ^1.4.1 - version: 1.4.1(vite@5.2.8) + version: 1.4.1(rollup@2.79.1)(vite@5.2.8) vite-plugin-vuetify: specifier: ^2.0.3 version: 2.0.3(vite@5.2.8)(vue@3.4.21)(vuetify@3.5.15) @@ -13706,7 +13709,7 @@ packages: rollup: 2.79.1 dev: true - /@rollup/pluginutils@5.1.0: + /@rollup/pluginutils@5.1.0(rollup@2.79.1): resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} engines: {node: '>=14.0.0'} peerDependencies: @@ -13718,6 +13721,7 @@ packages: '@types/estree': 1.0.5 estree-walker: 2.0.2 picomatch: 2.3.1 + rollup: 2.79.1 dev: true /@rollup/rollup-android-arm-eabi@4.10.0: @@ -25260,8 +25264,6 @@ packages: peerDependenciesMeta: webpack: optional: true - webpack-sources: - optional: true dependencies: webpack: 5.89.0(esbuild@0.19.11) webpack-sources: 3.2.3 @@ -34232,7 +34234,7 @@ packages: vite: 5.2.8(sass@1.71.1) dev: true - /unplugin-vue-components@0.26.0(vue@3.4.21): + /unplugin-vue-components@0.26.0(rollup@2.79.1)(vue@3.4.21): resolution: {integrity: sha512-s7IdPDlnOvPamjunVxw8kNgKNK8A5KM1YpK5j/p97jEKTjlPNrA0nZBiSfAKKlK1gWZuyWXlKL5dk3EDw874LQ==} engines: {node: '>=14'} peerDependencies: @@ -34246,7 +34248,7 @@ packages: optional: true dependencies: '@antfu/utils': 0.7.7 - '@rollup/pluginutils': 5.1.0 + '@rollup/pluginutils': 5.1.0(rollup@2.79.1) chokidar: 3.6.0 debug: 4.3.4(supports-color@8.1.1) fast-glob: 3.3.2 @@ -34585,6 +34587,28 @@ packages: - supports-color dev: true + /vite-plugin-pwa@0.19.2(vite@5.2.8)(workbox-build@7.0.0)(workbox-window@7.0.0): + resolution: {integrity: sha512-LSQJFPxCAQYbRuSyc9EbRLRqLpaBA9onIZuQFomfUYjWSgHuQLonahetDlPSC9zsxmkSEhQH8dXZN8yL978h3w==} + engines: {node: '>=16.0.0'} + peerDependencies: + '@vite-pwa/assets-generator': ^0.2.4 + vite: ^3.1.0 || ^4.0.0 || ^5.0.0 + workbox-build: ^7.0.0 + workbox-window: ^7.0.0 + peerDependenciesMeta: + '@vite-pwa/assets-generator': + optional: true + dependencies: + debug: 4.3.4(supports-color@8.1.1) + fast-glob: 3.3.2 + pretty-bytes: 6.1.1 + vite: 5.2.8(sass@1.71.1) + workbox-build: 7.0.0 + workbox-window: 7.0.0 + transitivePeerDependencies: + - supports-color + dev: true + /vite-plugin-top-level-await@1.4.1(rollup@2.79.1)(vite@5.1.5): resolution: {integrity: sha512-hogbZ6yT7+AqBaV6lK9JRNvJDn4/IJvHLu6ET06arNfo0t2IsyCaon7el9Xa8OumH+ESuq//SDf8xscZFE0rWw==} peerDependencies: @@ -34613,7 +34637,7 @@ packages: - rollup dev: true - /vite-plugin-top-level-await@1.4.1(vite@5.1.1): + /vite-plugin-top-level-await@1.4.1(rollup@2.79.1)(vite@5.2.8): resolution: {integrity: sha512-hogbZ6yT7+AqBaV6lK9JRNvJDn4/IJvHLu6ET06arNfo0t2IsyCaon7el9Xa8OumH+ESuq//SDf8xscZFE0rWw==} peerDependencies: vite: '>=2.8' @@ -34621,13 +34645,13 @@ packages: '@rollup/plugin-virtual': 3.0.2(rollup@2.79.1) '@swc/core': 1.4.6 uuid: 9.0.1 - vite: 5.1.1(@types/node@20.11.17) + vite: 5.2.8(sass@1.71.1) transitivePeerDependencies: - '@swc/helpers' - rollup dev: true - /vite-plugin-top-level-await@1.4.1(vite@5.1.4): + /vite-plugin-top-level-await@1.4.1(vite@5.1.1): resolution: {integrity: sha512-hogbZ6yT7+AqBaV6lK9JRNvJDn4/IJvHLu6ET06arNfo0t2IsyCaon7el9Xa8OumH+ESuq//SDf8xscZFE0rWw==} peerDependencies: vite: '>=2.8' @@ -34635,13 +34659,13 @@ packages: '@rollup/plugin-virtual': 3.0.2(rollup@2.79.1) '@swc/core': 1.4.6 uuid: 9.0.1 - vite: 5.1.4 + vite: 5.1.1(@types/node@20.11.17) transitivePeerDependencies: - '@swc/helpers' - rollup dev: true - /vite-plugin-top-level-await@1.4.1(vite@5.2.8): + /vite-plugin-top-level-await@1.4.1(vite@5.1.4): resolution: {integrity: sha512-hogbZ6yT7+AqBaV6lK9JRNvJDn4/IJvHLu6ET06arNfo0t2IsyCaon7el9Xa8OumH+ESuq//SDf8xscZFE0rWw==} peerDependencies: vite: '>=2.8' @@ -34649,7 +34673,7 @@ packages: '@rollup/plugin-virtual': 3.0.2(rollup@2.79.1) '@swc/core': 1.4.6 uuid: 9.0.1 - vite: 5.2.8(sass@1.71.1) + vite: 5.1.4 transitivePeerDependencies: - '@swc/helpers' - rollup @@ -35929,6 +35953,7 @@ packages: /workbox-google-analytics@7.0.0: resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==} + deprecated: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained dependencies: workbox-background-sync: 7.0.0 workbox-core: 7.0.0