-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathnuxt.config.ts
More file actions
105 lines (98 loc) · 2.78 KB
/
Copy pathnuxt.config.ts
File metadata and controls
105 lines (98 loc) · 2.78 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
import { existsSync, readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import tailwindcss from '@tailwindcss/vite'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import { PuikResolver } from '@prestashopcorp/puik-resolver'
export default defineNuxtConfig({
modules: ['@nuxt/eslint', '@nuxt/image', '@nuxt/test-utils'],
components: [
{
path: '~/components',
pathPrefix: false,
},
],
devtools: { enabled: true },
app: {
head: {
title: 'PrestaShop Top Contributors',
htmlAttrs: {
lang: 'en',
},
meta: [
{
name: 'description',
content: 'A list of PrestaShop contributors',
},
],
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
},
},
css: ['~/assets/css/main.css'],
compatibilityDate: '2025-07-15',
nitro: {
prerender: {
crawlLinks: true,
routes: ['/'],
},
},
vite: {
plugins: [
tailwindcss(),
Components({
resolvers: [PuikResolver()],
}),
AutoImport({
resolvers: [PuikResolver()],
}),
],
},
hooks: {
'nitro:config'(nitroConfig) {
const publicDir = resolve(__dirname, 'public')
const contribPath = `${publicDir}/contributors_prs.json`
const compPath = `${publicDir}/topcompanies_prs.json`
const routes: string[] = []
if (existsSync(contribPath)) {
try {
const data = JSON.parse(readFileSync(contribPath, 'utf-8'))
for (const login of Object.keys(data)) {
if (login === 'updatedAt') continue
routes.push(`/contributor/${encodeURIComponent(login)}`)
routes.push(`/card/${encodeURIComponent(login)}.svg`)
}
}
catch (err) {
console.warn('[prerender] failed to read contributors_prs.json:', (err as Error).message)
}
}
else {
console.warn('[prerender] contributors_prs.json missing — skipping contributor detail routes')
}
if (existsSync(compPath)) {
try {
const data = JSON.parse(readFileSync(compPath, 'utf-8'))
for (const c of data.companies ?? []) {
if (c.slug) routes.push(`/company/${c.slug}`)
}
}
catch (err) {
console.warn('[prerender] failed to read topcompanies_prs.json:', (err as Error).message)
}
}
else {
console.warn('[prerender] topcompanies_prs.json missing — skipping company detail routes')
}
nitroConfig.prerender = nitroConfig.prerender ?? {}
nitroConfig.prerender.routes = [
...(nitroConfig.prerender.routes ?? []),
...routes,
]
},
},
eslint: {
config: {
stylistic: true,
},
},
})