forked from Stapxs/Stapxs-QQ-Lite-2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
146 lines (139 loc) · 5.92 KB
/
vue.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
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
/**
* @type {import('@vue/cli-service').ProjectOptions}
*/
module.exports = {
publicPath: process.env.NODEJS_ENV === 'github-actions'
? '/Stapxs-QQ-Lite-2.0/'
: undefined
,
transpileDependencies: true,
configureWebpack: {
module: {
rules: [
{
test: /\.txt$/i,
use: 'raw-loader',
}
]
}
},
pwa: {
name: 'Stapxs QQ Lite',
themeColor: '#606E7A',
iconPaths: {
faviconSVG: 'img/icons/icon.svg',
favicon512: 'img/icons/icon.png',
appleTouchIcon: 'img/icons/icon-for-fuck-apple.png',
maskIcon: 'img/icons/icon-maskable.png'
},
manifestOptions: {
description: "一个兼容 oicq-http 的非官方网页版 QQ 客户端,使用 Vue 重制的全新版本。",
icons: [
{
"src": "img/icons/icon.svg",
"sizes": "1080x1080",
"purpose": "any"
},
{
"src": "img/icons/icon.png",
"type": "image/png",
"sizes": "512x512"
},
{
"src": "img/icons/icon-maskable.png",
"sizes": "1024x1024",
"type": "image/png",
"purpose": "maskable"
}
],
related_applications: [
{
"platform": "play",
"url": "https://play.google.com/store/apps/details?id=com.tencent.mobileqq",
"id": "com.tencent.mobileqq"
},
{
"platform": "itunes",
"url": "https://apps.apple.com/app/qq/id444934666"
}
]
}
},
pluginOptions: {
/**
* Electron Builder 设置
* @type {import('vue-cli-plugin-electron-builder').PluginOptions}
*/
electronBuilder: {
builderOptions: {
appId: 'com.stapxs.qq-web',
productName: 'Stapxs QQ Lite',
copyright: 'Copyright © 2022-2023 Stapx Steve [林槐]',
directories: {
output: 'dist_electron/out'
},
linux: {
target: process.env.NODEJS_ENV === 'github-actions' ? ['AppImage', 'tar.gz'] : 'pacman',
maintainer: 'Stapx Steve [林槐]',
vendor: 'Stapxs Steve Team',
synopsis: '一个兼容 oicq-http 的非官方网页版 QQ 客户端。',
category: 'Network',
// TODO: 将来可能需要占用 QQ 自己的 MIME 类型
mimeTypes: ['application/x-stapxs-qq-lite'],
desktop: {
Type: 'Application',
Name: 'Stapxs QQ Lite',
GenericName: 'Stapxs QQ Lite Electron 客户端',
Comment: '一个兼容 oicq-http 的非官方网页版 QQ 客户端。',
Terminal: 'false',
Category: 'Application',
Icon: 'stapxs-qq-lite'
}
},
win: {
target: 'portable',
appId: 'com.stapxs.qq-web',
icon: 'public/img/icons/icon.png',
legalTrademarks: 'Copyright © 2022-2023 Stapx Steve [林槐]',
},
afterAllArtifactBuild: async (context) => {
// 如果环境参数中有 `github-actions`,则删除 `dist_electron/out` 目录下所有的
// `*-unpacked` 目录和 `build` 开头的文件,便于 GitHub Actions 上传构建结果
if (process.env.NODEJS_ENV === 'github-actions') {
const fs = require('fs')
const path = require('path')
// 寻找所有需要删除的文件和目录
const delList = fs.readdirSync(context.outDir).filter((item) => {
return item.endsWith('-unpacked') || item.startsWith('build')
})
console.log('删除的目录和文件:', delList)
for (const item of delList) {
// 判断是文件还是目录
if (fs.statSync(path.join(context.outDir, item)).isDirectory()) {
fs.rmSync(path.join(context.outDir, item), { recursive: true })
} else {
fs.rmSync(path.join(context.outDir, item))
}
}
}
// 生成所有输出文件的 MD5 验证文件
const crypto = require('crypto')
const fs = require('fs')
const path = require('path')
const fileList = fs.readdirSync(context.outDir)
let md5List = []
for (const item of fileList) {
// 只包括 stapxs 开头的文件,忽略大小写,忽略文件夹
if (item.toLowerCase().startsWith('stapxs') &&
fs.statSync(path.join(context.outDir, item)).isFile()) {
const file = fs.readFileSync(path.join(context.outDir, item))
const md5Str = crypto.createHash('md5').update(file).digest('hex')
md5List.push(`${md5Str} ${item}`)
}
}
fs.writeFileSync(path.join(context.outDir, 'md5sum.txt'), md5List.join('\n'))
}
}
}
}
}