-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathvite.config.js
48 lines (45 loc) · 1.55 KB
/
vite.config.js
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
import { defineConfig } from 'vite';
import monkey, { util } from 'vite-plugin-monkey';
import mkcert from 'vite-plugin-mkcert';
import fs from 'fs';
import dotenv from 'dotenv';
import AutoImport from 'unplugin-auto-import/vite';
const date = new Date().toLocaleDateString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
});
// 读取并解析 version.env 文件
const envConfig = dotenv.parse(fs.readFileSync('./version.env'));
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
AutoImport({
imports: [util.unimportPreset],
}),
mkcert(),
monkey({
entry: 'src/main.js',
userscript: {
icon: 'http://cdn.arthals.ink/Arthals-mcskin.png',
namespace: 'arthals/pku-art',
name: 'PKU-Art',
description: '给你一个足够好看的教学网。',
match: ['*://*.pku.edu.cn/*'],
'run-at': 'document-start',
'inject-into': 'page',
version: envConfig.VERSION,
updateURL: 'https://cdn.arthals.ink/release/PKU-Art.user.js',
supportURL: 'https://github.com/zhuozhiyongde/PKU-Art/issues',
connect: ['pku.edu.cn'],
license: 'GPL-3.0 license',
author: 'Arthals',
$extra: {
'author-blog': 'https://arthals.ink',
date,
},
},
server: { mountGmApi: true },
}),
],
});