diff --git a/.gitignore b/.gitignore index b4bc601..4038539 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,8 @@ /resources/* + +# Node modules +*/node_modules/ + +# Production build output +*/dist/ +*/dev-dist/ \ No newline at end of file diff --git a/frontend/index.html b/frontend/index.html index 4dadc05..b496f6e 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -12,7 +12,7 @@ - + FlashNotes diff --git a/frontend/public/robots.txt b/frontend/public/robots.txt new file mode 100644 index 0000000..c2a49f4 --- /dev/null +++ b/frontend/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Allow: / diff --git a/frontend/public/site.webmanifest b/frontend/public/site.webmanifest deleted file mode 100644 index 544f26e..0000000 --- a/frontend/public/site.webmanifest +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Flash-Notes", - "short_name": "Flash-Notes", - "icons": [ - { - "src": "/web-app-manifest-192x192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "/web-app-manifest-512x512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "maskable" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 5fdfdb2..512b4cd 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -2,10 +2,50 @@ import { TanStackRouterVite } from "@tanstack/router-vite-plugin"; import react from "@vitejs/plugin-react-swc"; import { defineConfig } from "vite"; import tsconfigPaths from "vite-tsconfig-paths"; +import { VitePWA } from 'vite-plugin-pwa'; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react(), TanStackRouterVite(), tsconfigPaths()], + plugins: [react(), TanStackRouterVite(), tsconfigPaths(), + VitePWA({ + registerType: 'autoUpdate', + injectRegister: 'auto', + workbox: { + globPatterns: ['**/*.{js,css,html,ico,png,svg}'] + }, + devOptions: { + enabled: true, //only keep as true while developing, not in production + }, + includeAssets: ['favicon.ico', 'robots.txt', 'apple-touch-icon.png'], + manifest: { + name: 'Flash-Notes', + short_name: 'Flash-Notes', + description: 'Study flashcards online or offline, even as a guest!', + theme_color: '#ffffff', + background_color: '#ffffff', + display: 'standalone', + start_url: '/', + icons: [ + { + src: '/web-app-manifest-192x192.png', + sizes: '192x192', + type: 'image/png', + }, + { + src: '/web-app-manifest-512x512.png', + sizes: '512x512', + type: 'image/png', + }, + { + src: '/web-app-manifest-512x512.png', + sizes: '512x512', + type: 'image/png', + purpose: 'any maskable', + }, + ], + }, + }) + ], server: { watch: { usePolling: true,