dev-sidecar/packages/gui/vue.config.js

129 lines
4.0 KiB
JavaScript
Raw Normal View History

2024-11-18 17:41:53 +00:00
const path = require('node:path')
2024-11-18 17:59:04 +00:00
const { defineConfig } = require('@vue/cli-service')
const webpack = require('webpack')
2021-08-17 14:54:04 +00:00
const publishUrl = process.env.VUE_APP_PUBLISH_URL
2021-08-18 02:30:54 +00:00
const publishProvider = process.env.VUE_APP_PUBLISH_PROVIDER
2024-04-02 04:35:39 +00:00
console.log('Publish url:', publishUrl)
2024-11-18 17:59:04 +00:00
module.exports = defineConfig({
2020-11-09 10:58:14 +00:00
pages: {
index: {
entry: 'src/main.js',
title: 'DevSidecar-给开发者的边车辅助工具',
},
2020-11-09 10:58:14 +00:00
},
lintOnSave: false,
2024-11-15 10:02:36 +00:00
configureWebpack: {
plugins: [
new webpack.DefinePlugin({ 'global.GENTLY': true }),
],
module: {
rules: [
{
test: /\.json5$/i,
loader: 'json5-loader',
options: {
esModule: false,
},
2024-11-15 10:02:36 +00:00
type: 'javascript/auto',
},
],
},
2020-10-24 13:22:44 +00:00
},
pluginOptions: {
electronBuilder: {
2024-11-18 17:59:04 +00:00
mainProcessFile: './src/background.js',
// Ref: https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/1891
customFileProtocol: './',
externals: [
2024-11-26 16:52:16 +00:00
'@starknt/sysproxy',
'@starknt/sysproxy-win32-ia32-msvc',
'@starknt/sysproxy-win32-x64-msvc',
'@starknt/sysproxy-win32-arm64-msvc',
'@starknt/sysproxy-linux-x64-gnu',
'@starknt/sysproxy-linux-arm64-gnu',
'@starknt/sysproxy-darwin-x64',
'@starknt/sysproxy-darwin-arm64',
'@starknt/shutdown-handler-napi',
'@starknt/shutdown-handler-napi-win32-ia32-msvc',
'@starknt/shutdown-handler-napi-win32-x64-msvc',
'@starknt/shutdown-handler-napi-win32-arm64-msvc',
'@starknt/shutdown-handler-napi-linux-x64-gnu',
'@starknt/shutdown-handler-napi-linux-arm64-gnu',
'@starknt/shutdown-handler-napi-darwin-x64',
'@starknt/shutdown-handler-napi-darwin-arm64',
],
2020-10-24 13:22:44 +00:00
nodeIntegration: true,
// Provide an array of files that, when changed, will recompile the main process and restart Electron
// Your main process file will be added by default
mainProcessWatch: ['src/bridge', 'src/*.js', 'node_modules/dev-sidecar/src'],
builderOptions: {
2021-04-03 09:31:28 +00:00
afterPack: './pkg/after-pack.js',
2021-04-03 10:29:54 +00:00
afterAllArtifactBuild: './pkg/after-all-artifact-build.js',
2021-08-18 02:30:54 +00:00
// artifactBuildCompleted: './pkg/artifact-build-completed.js',
2021-04-03 09:23:22 +00:00
// builderOptions: {
// publish: ['github']// 此处写入github 就好,不用添加其他内容
// },
2020-10-24 13:22:44 +00:00
extraResources: [
{
2020-10-25 13:04:28 +00:00
from: 'extra',
to: 'extra',
},
2020-11-07 18:40:06 +00:00
],
appId: 'dev-sidecar',
2021-08-17 09:24:30 +00:00
productName: 'dev-sidecar',
2020-11-07 18:40:06 +00:00
// eslint-disable-next-line no-template-curly-in-string
2024-11-26 16:52:16 +00:00
artifactName: 'DevSidecar-${version}-${arch}.${ext}',
2025-01-16 03:21:05 +00:00
copyright: 'Copyright © 2020-2025 Greper, WangLiang',
2020-11-07 18:40:06 +00:00
nsis: {
oneClick: false,
2020-11-11 01:55:32 +00:00
perMachine: true,
2020-11-07 18:40:06 +00:00
allowElevation: true,
2021-11-11 13:23:45 +00:00
allowToChangeInstallationDirectory: true,
2020-11-07 18:40:06 +00:00
},
win: {
icon: 'build/icons/',
2024-11-26 16:52:16 +00:00
target: [
{
target: 'nsis',
arch: ['x64', 'ia32', 'arm64'],
},
],
2024-11-26 09:47:11 +00:00
// requestedExecutionLevel: 'highestAvailable', // 加了这个无法开机自启
},
2021-08-15 13:09:45 +00:00
linux: {
2021-08-17 10:57:22 +00:00
icon: 'build/mac/',
2021-08-15 13:09:45 +00:00
target: [
2024-11-26 16:52:16 +00:00
{
target: 'deb',
arch: ['x64', 'arm64', 'armv7l'],
2024-11-26 16:52:16 +00:00
},
{
target: 'AppImage',
arch: ['x64', 'arm64', 'armv7l'],
2024-11-26 16:52:16 +00:00
},
],
2024-11-26 16:52:16 +00:00
category: 'System',
2021-08-15 13:09:45 +00:00
},
mac: {
icon: './build/mac/icon.icns',
target: {
target: 'dmg',
arch: ['x64', 'arm64', 'universal'],
},
category: 'public.app-category.developer-tools',
},
2020-11-09 10:58:14 +00:00
publish: {
2021-08-18 02:30:54 +00:00
provider: publishProvider,
url: publishUrl,
2024-11-26 09:47:11 +00:00
// url: 'http://dev-sidecar.docmirror.cn/update/preview/',
},
2020-11-06 10:59:54 +00:00
},
chainWebpackMainProcess (config) {
config.entry('mitmproxy').add(path.join(__dirname, 'src/bridge/mitmproxy.js'))
},
},
},
2024-11-18 17:59:04 +00:00
})