2019-12-19 19:17:21 +08:00
|
|
|
const path = require('path')
|
|
|
|
function resolve (dir) {
|
|
|
|
return path.join(__dirname, dir)
|
|
|
|
}
|
2021-03-28 17:44:07 +08:00
|
|
|
|
|
|
|
const config = {
|
|
|
|
configureWebpack: {
|
|
|
|
devtool: 'nosources-source-map'
|
|
|
|
},
|
2019-12-19 19:17:21 +08:00
|
|
|
chainWebpack: config => {
|
|
|
|
config.resolve.alias
|
|
|
|
.set('@', resolve('src/renderer'))
|
|
|
|
.set('~', resolve('src'))
|
|
|
|
.set('root', resolve('./'))
|
|
|
|
.set('#', resolve('src/universal'))
|
2021-04-10 21:01:55 +08:00
|
|
|
// define
|
|
|
|
// config.plugin('define')
|
|
|
|
// .tap(args => {
|
|
|
|
// return args
|
|
|
|
// })
|
2019-12-19 19:17:21 +08:00
|
|
|
},
|
|
|
|
pluginOptions: {
|
|
|
|
electronBuilder: {
|
2022-01-04 23:40:28 +08:00
|
|
|
nodeIntegration: true, // will remove in the future
|
2019-12-20 18:46:39 +08:00
|
|
|
customFileProtocol: 'picgo://./',
|
2023-02-15 23:36:47 +08:00
|
|
|
externals: ['piclist'],
|
2019-12-19 19:17:21 +08:00
|
|
|
chainWebpackMainProcess: config => {
|
|
|
|
config.resolve.alias
|
|
|
|
.set('@', resolve('src/renderer'))
|
|
|
|
.set('~', resolve('src'))
|
|
|
|
.set('root', resolve('./'))
|
|
|
|
.set('#', resolve('src/universal'))
|
2020-04-10 23:28:46 +08:00
|
|
|
.set('apis', resolve('src/main/apis'))
|
|
|
|
.set('@core', resolve('src/main/apis/core'))
|
2022-06-12 20:20:08 +08:00
|
|
|
config.resolve.mainFields
|
|
|
|
.clear()
|
|
|
|
.add('main') // fix some modules will use browser target
|
|
|
|
.add('module')
|
2019-12-19 19:17:21 +08:00
|
|
|
},
|
|
|
|
builderOptions: {
|
2023-02-15 23:36:47 +08:00
|
|
|
productName: 'PicList',
|
|
|
|
appId: 'com.kuingsmile.piclist',
|
2023-03-07 17:07:17 +08:00
|
|
|
afterSign: 'scripts/notarize.js',
|
2020-01-01 18:18:51 +08:00
|
|
|
publish: [
|
2023-04-05 22:55:35 +08:00
|
|
|
{
|
|
|
|
provider: 's3',
|
|
|
|
bucket: 'piclist-dl',
|
|
|
|
region: 'auto',
|
|
|
|
acl: 'private',
|
|
|
|
endpoint: 'https://7ab4ed5cb1f4052a13d3b573876ecf33.r2.cloudflarestorage.com',
|
|
|
|
path: '/latest'
|
|
|
|
},
|
2020-01-01 18:18:51 +08:00
|
|
|
{
|
|
|
|
provider: 'github',
|
2023-02-15 23:36:47 +08:00
|
|
|
owner: 'Kuingsmile',
|
|
|
|
repo: 'PicList',
|
2020-01-01 18:18:51 +08:00
|
|
|
releaseType: 'draft'
|
|
|
|
}
|
|
|
|
],
|
2019-12-19 19:17:21 +08:00
|
|
|
dmg: {
|
2023-03-07 13:09:56 +08:00
|
|
|
sign: false,
|
2019-12-19 19:17:21 +08:00
|
|
|
contents: [
|
|
|
|
{
|
|
|
|
x: 410,
|
|
|
|
y: 150,
|
|
|
|
type: 'link',
|
|
|
|
path: '/Applications'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
x: 130,
|
|
|
|
y: 150,
|
|
|
|
type: 'file'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
mac: {
|
|
|
|
icon: 'build/icons/icon.icns',
|
|
|
|
extendInfo: {
|
2023-04-05 13:02:17 +08:00
|
|
|
LSUIElement: 0
|
2022-01-05 12:54:02 +08:00
|
|
|
},
|
|
|
|
target: [{
|
2023-04-06 23:33:35 +08:00
|
|
|
target: 'default',
|
2022-01-06 00:01:26 +08:00
|
|
|
arch: [
|
2023-04-05 22:55:35 +08:00
|
|
|
'universal',
|
2022-01-06 00:01:26 +08:00
|
|
|
'x64',
|
|
|
|
'arm64'
|
|
|
|
]
|
2022-01-05 12:54:02 +08:00
|
|
|
}],
|
2022-01-06 00:01:26 +08:00
|
|
|
// eslint-disable-next-line no-template-curly-in-string
|
2023-04-07 05:19:16 +08:00
|
|
|
artifactName: 'PicList-${version}-${arch}.${ext}'
|
2019-12-19 19:17:21 +08:00
|
|
|
},
|
|
|
|
win: {
|
|
|
|
icon: 'build/icons/icon.ico',
|
2021-07-14 23:46:33 +08:00
|
|
|
// eslint-disable-next-line no-template-curly-in-string
|
2023-02-15 23:36:47 +08:00
|
|
|
artifactName: 'PicList-Setup-${version}-${arch}.exe',
|
2023-04-08 18:31:22 +08:00
|
|
|
verifyUpdateCodeSignature: false,
|
2021-07-10 00:36:31 +08:00
|
|
|
target: [{
|
2021-07-14 23:46:33 +08:00
|
|
|
target: 'nsis',
|
2021-07-10 00:36:31 +08:00
|
|
|
arch: [
|
2022-01-06 00:01:26 +08:00
|
|
|
'x64',
|
|
|
|
'ia32'
|
2021-07-10 00:36:31 +08:00
|
|
|
]
|
|
|
|
}]
|
2019-12-19 19:17:21 +08:00
|
|
|
},
|
|
|
|
nsis: {
|
2023-02-15 23:36:47 +08:00
|
|
|
shortcutName: 'PicList',
|
2019-12-19 19:17:21 +08:00
|
|
|
oneClick: false,
|
2022-11-19 21:47:23 +08:00
|
|
|
allowToChangeInstallationDirectory: true,
|
|
|
|
include: 'build/installer.nsh'
|
2019-12-19 19:17:21 +08:00
|
|
|
},
|
|
|
|
linux: {
|
2023-03-31 00:17:39 +08:00
|
|
|
icon: 'build/icons/',
|
|
|
|
asarUnpack: [
|
|
|
|
'**/node_modules/sharp/**'
|
|
|
|
]
|
2020-01-01 18:18:51 +08:00
|
|
|
},
|
|
|
|
snap: {
|
|
|
|
publish: ['github']
|
2019-12-19 19:17:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-28 17:44:07 +08:00
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
|
|
config.configureWebpack = {
|
2021-08-01 15:44:59 +08:00
|
|
|
devtool: 'source-map'
|
2021-03-28 17:44:07 +08:00
|
|
|
}
|
2021-04-05 16:09:27 +08:00
|
|
|
// for dev main process hot reload
|
|
|
|
config.pluginOptions.electronBuilder.mainProcessWatch = ['src/main/**/*']
|
2021-03-28 17:44:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
...config
|
|
|
|
}
|