Files
crumbs-original/vite.config.ts
T
Frederic CabassutandClaude Opus 4.6 4ef5dbf20b feat: add code coverage with artifact upload for unit and E2E tests
Add V8 coverage for unit tests via @vitest/coverage-v8 and Istanbul
instrumentation for E2E tests via vite-plugin-istanbul. Coverage data
is collected from browser pages after each Playwright test and merged
with nyc. CI uploads both coverage reports as GitHub Actions artifacts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 09:30:08 +01:00

66 lines
1.7 KiB
TypeScript

import { sveltekit } from '@sveltejs/kit/vite';
import { SvelteKitPWA } from '@vite-pwa/sveltekit';
import tailwindcss from '@tailwindcss/vite';
import istanbul from 'vite-plugin-istanbul';
import { defineConfig } from 'vite';
export default defineConfig({
build: {
chunkSizeWarningLimit: 850
},
plugins: [
tailwindcss(),
sveltekit(),
...(process.env.VITE_COVERAGE === 'true'
? [
istanbul({
include: 'src/**/*',
exclude: ['node_modules', 'tests/', '**/*.test.ts'],
extension: ['.ts', '.svelte'],
requireEnv: true,
forceBuildInstrument: true
})
]
: []),
SvelteKitPWA({
registerType: 'autoUpdate',
manifest: {
name: 'Crumbs by Bretzel',
short_name: 'Crumbs',
description: 'A self-hostable, offline-first note-taking app by Bretzel',
start_url: '/',
display: 'standalone',
background_color: '#f0e6d3',
theme_color: '#C8860A',
icons: [
{ src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png' },
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' }
]
},
workbox: {
globPatterns: ['client/**/*.{js,css,ico,png,svg,webp,woff,woff2}'],
navigateFallback: '/',
runtimeCaching: [
{
urlPattern: /\/api\/notes\/.*\/attachments\?attachmentId=/,
handler: 'CacheFirst',
options: {
cacheName: 'attachment-cache',
expiration: { maxEntries: 200, maxAgeSeconds: 365 * 24 * 60 * 60 }
}
},
{
urlPattern: /^https?:\/\/.*\/api\//,
handler: 'NetworkFirst',
options: {
cacheName: 'api-cache',
expiration: { maxEntries: 50, maxAgeSeconds: 300 }
}
}
]
}
})
]
});