参考文档
Electron builder官方文档
简书配置总结
package.json
{"name": "timer","version": "1.0.0","description": "会议计时器","main": "main.js","scripts": {"test": "echo \"Error: no test specified\" && exit 1","start": "electron .","dist-win": "electron-builder --win","dist-mac": "electron-builder --mac","dist-linux": "electron-builder --linux"},"repository": {"type": "git","url": "https://gitee.com/l-xiang/timer.git"},"author": "Gort","license": "ISC","devDependencies": {"electron": "^22.0.0"},"build": {"productName":"timer","appId": "cnnc.timer","copyright":"©2023 中核四川环保 信息中心 Gort","directories": {"output": "build"},"win": {"icon": "resources/ico.ico","target": [{"target": "nsis","arch": ["ia32","x64"]}]},"mac": {"icon": "resources/ico.ico","target": [{"target": "dmg","arch": ["arm64"]}]},"linux": {"icon": "resources/ico.ico","target": [{"target": "snap","arch": ["arm64"]}]},"nsis": {"oneClick": false,"allowElevation": true, // 允许请求提升。 如果为false,则用户必须使用提升的权限重新启动安装程序。"allowToChangeInstallationDirectory": true, // 允许修改安装目录"installerIcon": "./resources/ico.ico",// 安装图标"uninstallerIcon": "./resources/ico.ico",//卸载图标"installerHeaderIcon": "./resources/ico.ico", // 安装时头部图标"createDesktopShortcut": true, // 创建桌面图标"createStartMenuShortcut": true,// 创建开始菜单图标"shortcutName": "计时器", // 图标名称"include": "build/script/installer.nsh" // 包含的自定义nsis脚本},"dmg": {"contents": [{"x": 410,"y": 150,"type": "link","path": "/Applications"},{"x": 130,"y": 150,"type": "file"}]},"publish": [{"provider": "https://gitee.com/l-xiang/timer.git", // 服务器提供商 也可以是GitHub等等"url": "http://xxxxx/" // 服务器地址}]}
}