Add PWA support and update app metadata for Deckerr

This commit is contained in:
Matthieu
2025-11-21 16:41:47 +01:00
parent 57f0e7efe7
commit 73b7735074
19 changed files with 9454 additions and 186 deletions

View File

@@ -1,10 +1,99 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { VitePWA } from 'vite-plugin-pwa';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['icon.svg'],
manifest: {
name: 'Deckerr - Card Deck Manager',
short_name: 'Deckerr',
description: 'Manage your trading card game decks on the go',
theme_color: '#0f172a',
background_color: '#0f172a',
display: 'standalone',
orientation: 'portrait',
scope: '/',
start_url: '/',
icons: [
{
src: 'icon.svg',
sizes: '512x512',
type: 'image/svg+xml',
purpose: 'any'
},
{
src: 'icon.svg',
sizes: '512x512',
type: 'image/svg+xml',
purpose: 'maskable'
}
],
categories: ['games', 'utilities'],
shortcuts: [
{
name: 'My Decks',
short_name: 'Decks',
description: 'View your deck collection',
url: '/?page=home'
},
{
name: 'Search Cards',
short_name: 'Search',
description: 'Search for cards',
url: '/?page=search'
},
{
name: 'Life Counter',
short_name: 'Life',
description: 'Track life totals',
url: '/?page=life-counter'
}
]
},
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2}'],
runtimeCaching: [
{
urlPattern: /^https:\/\/api\.scryfall\.com\/.*/i,
handler: 'CacheFirst',
options: {
cacheName: 'scryfall-cache',
expiration: {
maxEntries: 500,
maxAgeSeconds: 60 * 60 * 24 * 7 // 7 days
},
cacheableResponse: {
statuses: [0, 200]
}
}
},
{
urlPattern: /^https:\/\/cards\.scryfall\.io\/.*/i,
handler: 'CacheFirst',
options: {
cacheName: 'card-images-cache',
expiration: {
maxEntries: 1000,
maxAgeSeconds: 60 * 60 * 24 * 30 // 30 days
},
cacheableResponse: {
statuses: [0, 200]
}
}
}
]
},
devOptions: {
enabled: true
}
})
],
optimizeDeps: {
exclude: ['lucide-react'],
},
});
});