- Translated comments from Spanish to English in vite.config.ts, docker-compose.yml, attendance-risk.ts, analytics.ts, attendance.ts, attendees.ts, enums.ts, groups.ts, and onboarding.ts. - Improved descriptions for better understanding of code functionality and purpose. - Ensured uniformity in terminology and phrasing throughout the codebase.
83 lines
3.1 KiB
TypeScript
83 lines
3.1 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import { tanstackRouter } from '@tanstack/router-plugin/vite'
|
|
import { VitePWA } from 'vite-plugin-pwa'
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
tanstackRouter({ target: 'react' }),
|
|
react(),
|
|
tailwindcss(),
|
|
VitePWA({
|
|
// `autoUpdate` turns on skipWaiting + clientsClaim: the new SW takes
|
|
// control on the next load without asking the user for anything.
|
|
registerType: 'autoUpdate',
|
|
// Registration is done from PwaProvider so we can tell the user when the
|
|
// app is ready to work offline.
|
|
injectRegister: null,
|
|
// The icons already come in through `workbox.globPatterns`; with
|
|
// `includeManifestIcons` they would be listed twice in the precache.
|
|
includeManifestIcons: false,
|
|
manifest: {
|
|
name: 'Gruperly',
|
|
short_name: 'Gruperly',
|
|
description: 'Gestión de cobros grupales',
|
|
lang: 'es',
|
|
dir: 'ltr',
|
|
start_url: '/',
|
|
scope: '/',
|
|
display: 'standalone',
|
|
orientation: 'portrait',
|
|
theme_color: '#ffffff',
|
|
background_color: '#ffffff',
|
|
categories: ['finance', 'productivity'],
|
|
icons: [
|
|
{ src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
|
|
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png' },
|
|
{
|
|
src: 'pwa-maskable-512x512.png',
|
|
sizes: '512x512',
|
|
type: 'image/png',
|
|
purpose: 'maskable',
|
|
},
|
|
],
|
|
shortcuts: [
|
|
{ name: 'Mis grupos', url: '/groups' },
|
|
{ name: 'Cobros', url: '/payments' },
|
|
],
|
|
},
|
|
workbox: {
|
|
// Inter's woff2 is imported from node_modules: Vite emits it to
|
|
// assets/ with a hash and it goes into the precache so the app opens
|
|
// offline.
|
|
globPatterns: ['**/*.{js,css,html,svg,png,ico,woff2}'],
|
|
// Only the SW script is left out: precaching it would cache the old
|
|
// version. The `workbox-<hash>.js` runtime *is* precached on purpose, so
|
|
// the SW can boot without network. Do not use `**/workbox-*.js`: that
|
|
// pattern also matches `workbox-window.*.js`, which is the client module
|
|
// that imports `virtual:pwa-register` and without it registration fails.
|
|
globIgnores: ['**/sw.js'],
|
|
// App shell for every navigation, including the deep routes
|
|
// /join/$token and /report-absence/$token.
|
|
navigateFallback: '/index.html',
|
|
navigateFallbackDenylist: [/^\/api\//],
|
|
cleanupOutdatedCaches: true,
|
|
runtimeCaching: [
|
|
{
|
|
// The API is never cached: it holds payment data and a stale
|
|
// response is worse than an error. Offline loads the shell, not
|
|
// the data.
|
|
urlPattern: ({ url, request }) => request.method !== 'GET' || url.pathname.startsWith('/api/'),
|
|
handler: 'NetworkOnly',
|
|
},
|
|
],
|
|
},
|
|
devOptions: { enabled: true, type: 'module' },
|
|
}),
|
|
],
|
|
server: {
|
|
port: 6173,
|
|
},
|
|
})
|