feat: 完善mac打包规则 修复 icon显示问题

This commit is contained in:
alger
2024-11-20 22:44:17 +08:00
parent f320f4760b
commit 3027a5f6ff
6 changed files with 54 additions and 2 deletions
+2
View File
@@ -14,3 +14,5 @@ package-lock.json
dist.zip dist.zip
.vscode .vscode
bun.lockb
+1 -1
View File
@@ -24,7 +24,7 @@ function createWindow() {
} else { } else {
win.loadURL(`file://${__dirname}/dist/index.html`); win.loadURL(`file://${__dirname}/dist/index.html`);
} }
const image = nativeImage.createFromPath(path.join(__dirname, 'public/icon.png')); const image = nativeImage.createFromPath(path.join(__dirname, 'public/icon_16x16.png')).resize({ width: 16, height: 16 });
const tray = new Tray(image); const tray = new Tray(image);
// 创建一个上下文菜单 // 创建一个上下文菜单
+49
View File
@@ -0,0 +1,49 @@
{
"appId": "com.alger.music",
"productName": "AlgerMusic",
"artifactName": "${productName}_${version}_${arch}.${ext}",
"directories": {
"output": "dist_electron/mac"
},
"files": [
"dist/**/*",
"package.json",
"app.js",
"electron/**/*",
"**/*",
"public/**/*",
"node_modules/**/*"
],
"mac": {
"icon": "public/icon.icns",
"target": [
{
"target": "dmg",
"arch": ["x64", "arm64"]
}
],
"category": "public.app-category.music",
"darkModeSupport": true
},
"dmg": {
"title": "${productName} ${version}",
"icon": "public/icon.icns",
"contents": [
{
"x": 410,
"y": 150,
"type": "link",
"path": "/Applications"
},
{
"x": 130,
"y": 150,
"type": "file"
}
],
"window": {
"width": 540,
"height": 380
}
}
}
+2 -1
View File
@@ -12,7 +12,8 @@
"lint": "eslint --ext .vue,.js,.jsx,.ts,.tsx ./ --max-warnings 0", "lint": "eslint --ext .vue,.js,.jsx,.ts,.tsx ./ --max-warnings 0",
"b:win:x64": "electron-builder --config ./build/win64.json", "b:win:x64": "electron-builder --config ./build/win64.json",
"b:win:x86": "electron-builder --config ./build/win32.json", "b:win:x86": "electron-builder --config ./build/win32.json",
"b:win:arm": "electron-builder --config ./build/winarm64.json" "b:win:arm": "electron-builder --config ./build/winarm64.json",
"b:mac": "electron-builder --config ./build/mac.json"
}, },
"dependencies": { "dependencies": {
"electron-store": "^8.1.0" "electron-store": "^8.1.0"
BIN
View File
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B