This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.ts
131 lines (128 loc) · 4.03 KB
/
nuxt.config.ts
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
import { createResolver } from '@nuxt/kit'
import { isProduction } from 'std-env'
import { capitalize } from './utils/capitalize-method'
import pkg from './package.json'
const { resolve } = createResolver(import.meta.url)
const currentDir = dirname(fileURLToPath(import.meta.url))
const oneDay = 60 * 60 * 24 * 1000
const oneWeek = oneDay * 7
export default defineNuxtConfig({
css: [join(currentDir, './assets/style.css')],
nitro: {
prerender: {
routes: ['/rss.xml', '/sitemap.xml', '/']
}
},
runtimeConfig: {
timestamp: {
created: false,
updated: false
},
site: {
title: capitalize(pkg.name),
description: 'Guide to Create Google App in one day or one week, depending on the programming skills.',
image: `${pkg.homepage}/img/svg/avatar.svg`, // avatar also in appconfig
favicon: `${pkg.homepage}/favicon.svg`, // favicon also in appconfig
copyright: `All rights reserved ${(new Date()).getFullYear()}, Kyrie Eleison`
},
public: {
hostname: pkg.homepage,
production_mode: isProduction
},
auth: {
cookieName: process.env.COOKIE_NAME || '__session',
cookieSecret: process.env.COOKIE_SECRET || 'secret',
cookieExpires: parseInt(process.env.COOKIE_REMEMBER_ME_EXPIRES || oneDay.toString(), 10), // 1 day
cookieRememberMeExpires: parseInt(process.env.COOKIE_REMEMBER_ME_EXPIRES || oneWeek.toString(), 10), // 7 days
}
},
modules: [
[resolve('./modules/copy-image-files'), { cleanFolders: ['public/article'] }],
'@nuxt/content',
'@nuxtjs/tailwindcss',
'@vite-pwa/nuxt',
'nuxt-svgo',
'@pinia/nuxt'
],
// experimental: { payloadExtraction: false },
pwa: {
manifest: false, // public/manifest.webmanifest
strategies: 'generateSW',
injectRegister: 'script',
registerType: 'autoUpdate',
workbox: {
navigateFallback: '/',
globPatterns: ['**/*.{js,css,html,json,webp,svg,png,webmanifest}'],
globIgnores: ['google*.*'],
navigateFallbackDenylist: [
/^\/.*\\?giscus=.*/,
/^\/.*\\?api.*/,
/^\/.*\\?search.*/,
/^\/privacy.txt$/,
/^\/rss.xml$/,
/^\/sitemap.xml$/,
/\/assetslinks.json$/
],
runtimeCaching: [
{
urlPattern: ({ url, sameOrigin }) => sameOrigin && url.pathname.match(/^\/.*(avatar|favicon|privacy|rss|sitemap).*/i),
handler: 'NetworkFirst' as const,
options: { cacheName: 'frontpage' }
}, // Every article have to be visited before it is cached
{
urlPattern: ({ url, sameOrigin }) => sameOrigin && url.pathname.match(/^\/(api|article)\/.*/i),
handler: 'NetworkFirst' as const,
options: { cacheName: 'articles' }
} // when this is cached - the frontpage is working offline
]
},
devOptions: {
enabled: true,
type: 'module',
suppressWarnings: true,
navigateFallback: '/',
navigateFallbackAllowlist: [/^\/$/]
},
client: {
installPrompt: true
// periodicSyncForUpdates: 300 // per 5 min for testing only
}
},
svgo: { autoImportPath: join(currentDir, './assets/icons') },
components: [
{ path: './components/custom', pathPrefix: false },
{ path: './components/content', pathPrefix: false },
{ path: './components' }
],
// https://content.nuxtjs.org
content: {
navigation: {
fields: ['_id', '_type', 'series', 'tags']
},
highlight: {
// https://github.com/shikijs/shiki/blob/main/docs/themes.md#all-theme
theme: 'one-dark-pro',
preload: ['vue', 'markdown', 'md']
},
markdown: {
toc: {
depth: 5,
searchDepth: 5
}
}
},
typescript: {
shim: false,
typeCheck: true
},
devtools: { enabled: false }
})
/*
Continue work withthis:
https://vite-pwa-org.netlify.app/workbox/generate-sw.html
See the network session for url-adr.
See the discussion about url to discus back to the page
Maybe this is removed by my code?
*/