-
Notifications
You must be signed in to change notification settings - Fork 445
/
Copy pathnuxt.config.ts
184 lines (181 loc) · 4.39 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import AutoImport from "unplugin-auto-import/vite";
import { NaiveUiResolver } from "unplugin-vue-components/resolvers";
import Components from "unplugin-vue-components/vite";
import pkg from "./package.json";
// https://nuxt.com/docs/api/configuration/nuxt-config
// site env
const siteConfig = {
siteTitle: process.env.SITE_TITLE || "IMSYY 站点监测",
siteDescription: process.env.SITE_DESCRIPTION || "一个简约的站点监测",
siteKeywords: process.env.SITE_KEYWORDS || "站点监测,监测,监控",
siteLogo: process.env.SITE_LOGO || "/favicon.ico",
siteIcp: process.env.SITE_ICP || "",
countDays: Number(process.env.COUNT_DAYS || 60),
showLink: process.env.SHOW_LINK === "true" || true,
platform: process.env.DEPLOYMENT_PLATFORM || "cloudflare",
version: pkg.version,
};
export default defineNuxtConfig({
// modules
modules: [
"@pinia/nuxt",
"pinia-plugin-persistedstate",
"@nuxt/eslint",
"nuxtjs-naive-ui",
"@vite-pwa/nuxt",
"@nuxt/icon",
"@nuxtjs/color-mode",
"@vueuse/nuxt",
"nuxt-lodash",
"@nuxtjs/i18n",
].concat(siteConfig.platform === "cloudflare" ? "@nuxthub/core" : ""),
// ssr
ssr: false,
// devtools
devtools: { enabled: true },
// app
app: {
rootAttrs: { id: "nuxt-app" },
// site-meta
head: {
title: siteConfig.siteTitle,
meta: [
{
name: "description",
content: siteConfig.siteDescription,
},
{
name: "keywords",
content: siteConfig.siteKeywords,
},
{
name: "viewport",
content: "width=device-width, initial-scale=1.0",
},
{
name: "theme-color",
content: "#ffffff",
},
],
link: [
{ rel: "icon", href: siteConfig.siteLogo },
{
rel: "apple-touch-icon",
href: "/images/icons/normal/apple-touch-icon-180x180.png",
sizes: "180x180",
},
{
rel: "mask-icon",
href: "/images/icons/normal/maskable-icon-512x512.png",
color: "#ffffff",
},
// manifest
process.env.NODE_ENV !== "development"
? {
rel: "manifest",
href: "/manifest.webmanifest",
}
: undefined,
],
htmlAttrs: {
lang: "zh-CN",
},
},
},
// css
css: ["~/style/main.scss", "~/style/animate.scss"],
// env
runtimeConfig: {
apiUrl: process.env.API_URL || "https://api.uptimerobot.com/v2/",
apiKey: process.env.API_KEY,
sitePassword: process.env.SITE_PASSWORD,
siteSecretKey: process.env.SITE_SECRE_KEY || "site-status",
public: siteConfig,
},
devServer: { port: 8566 },
future: { compatibilityVersion: 4 },
compatibilityDate: "2024-11-11",
// vite
vite: {
plugins: [
AutoImport({
imports: [
{
"naive-ui": [
"useDialog",
"useMessage",
"useNotification",
"useLoadingBar",
],
},
],
}),
Components({
resolvers: [NaiveUiResolver()],
}),
],
css: {
preprocessorOptions: {
scss: {
silenceDeprecations: ["legacy-js-api"],
},
},
},
},
// https://eslint.nuxt.com
eslint: {
config: {
stylistic: {
quotes: "double",
semi: true,
},
},
},
// i18n
i18n: {
vueI18n: "./lang/i18n.config.ts",
},
// icon
icon: {
mode: "svg",
customCollections: [
{
prefix: "icon",
dir: "./app/assets/icons",
normalizeIconName: false,
},
],
},
// pwa
pwa: {
manifest: {
name: siteConfig.siteTitle,
short_name: siteConfig.siteDescription,
description: siteConfig.siteDescription,
theme_color: "#ffffff",
icons: [
{
src: "/images/icons/normal/pwa-64x64.png",
sizes: "64x64",
type: "image/png",
},
{
src: "/images/icons/normal/pwa-192x192.png",
sizes: "192x192",
type: "image/png",
},
{
src: "/images/icons/normal/pwa-512x512.png",
sizes: "512x512",
type: "image/png",
},
{
src: "/images/icons/normal/maskable-icon-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
},
},
});