-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
108 lines (105 loc) · 2.74 KB
/
Copy pathvite.config.ts
File metadata and controls
108 lines (105 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { defineConfig } from 'vite';
import { fileURLToPath } from 'node:url';
import react from '@vitejs/plugin-react-swc';
import { VitePWA } from 'vite-plugin-pwa';
import type { RuntimeCachingEntry, VitePWAOptions } from 'vite-plugin-pwa';
const googleFontsRuntimeCaching: RuntimeCachingEntry[] = [
{
urlPattern: ({ url }) => url.origin === 'https://fonts.googleapis.com',
handler: 'CacheFirst',
options: {
cacheName: 'google-fonts-stylesheets',
expiration: {
maxEntries: 20,
maxAgeSeconds: 60 * 60 * 24 * 30, // 30 days
},
},
},
{
urlPattern: ({ url }) => url.origin === 'https://fonts.gstatic.com',
handler: 'CacheFirst',
options: {
cacheName: 'google-fonts-webfonts',
expiration: {
maxEntries: 20,
maxAgeSeconds: 60 * 60 * 24 * 365, // 1 year
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
];
const pwaOptions: VitePWAOptions = {
base: './',
registerType: 'autoUpdate',
injectRegister: null,
includeAssets: [
'icons/apple-touch-icon.svg',
'icons/favicon.svg',
'icons/hk-icon-192.svg',
'icons/hk-icon-512.svg',
],
manifest: {
name: 'Hollow Knight Damage Tracker',
short_name: 'HK Damage',
description:
'Track Hollow Knight damage values and plan combat strategies on the go.',
start_url: '/hollow-knight-damage-tracker/',
scope: '/hollow-knight-damage-tracker/',
display: 'standalone',
background_color: '#0b0d1c',
theme_color: '#0b0d1c',
icons: [
{
src: './icons/hk-icon-192.svg',
sizes: '192x192',
type: 'image/svg+xml',
purpose: 'any maskable',
},
{
src: './icons/hk-icon-512.svg',
sizes: '512x512',
type: 'image/svg+xml',
purpose: 'any maskable',
},
],
},
workbox: {
globPatterns: ['**/*.{js,css,html,svg,png,ico,json,txt,woff2}'],
cleanupOutdatedCaches: true,
runtimeCaching: googleFontsRuntimeCaching,
},
devOptions: {
enabled: true,
},
};
export default defineConfig({
base: './',
plugins: [react(), VitePWA(pwaOptions)],
server: {
open: true,
},
preview: {
port: 4173,
},
test: {
globals: true,
environment: 'jsdom',
// Resolve setup file relative to this config file to avoid monorepo root issues
setupFiles: fileURLToPath(new URL('./vitest.setup.ts', import.meta.url)),
css: true,
testTimeout: 20000,
exclude: ['tests/e2e/**', 'node_modules/**', 'dist/**'],
coverage: {
provider: 'v8',
reporter: ['text', 'html'],
include: ['src/**/*.{ts,tsx}'],
exclude: ['src/main.tsx', 'src/vite-env.d.ts'],
statements: 80,
branches: 70,
functions: 80,
lines: 80,
},
},
});