dan*_*ler 11 javascript build node.js electron electron-forge
我目前正在使用 Electron(-forge) 为 Mac、Linux 和 Windows 构建一个跨平台应用程序。我使用的是 Mac,并且npm run make该应用程序是为 Mac 打包和构建的。
有没有什么方法(构建命令中的标志或其他东西)可以在Mac上为Linux和Windows构建应用程序?
预先感谢您的任何帮助!
尝试使用参数执行命令:
npm run make -- --platform win32
npm run make -- --platform linux
npm run make -- --platform darwin
Run Code Online (Sandbox Code Playgroud)
小智 6
是的,这是可能的,如 Electron forge makers文档中所示:
You can only build the Squirrel.Windows target on a Windows machine or on a macOS /Linux machine with mono and wine installedYou can only build the deb target on Linux or macOS machines with the fakeroot and dpkg packages installed. makers: [
{
name: '@electron-forge/maker-dmg',
config: {
icon: `${iconPath}.icns`,
},
},
{
name: '@electron-forge/maker-squirrel',
config: {
authors: 'YOU',
iconUrl: 'https://your_site/favicon.ico',
exe: `${BUILD_NAME}.exe`,
name: BUILD_NAME,
},
},
{
name: '@electron-forge/maker-deb',
config: {
options: {
bin: BUILD_NAME,
maintainer: 'YOU',
homepage: 'https://you home page',
},
},
},
],
Run Code Online (Sandbox Code Playgroud)
就我个人而言,我在 Gitlab CI 中运行构建。
这允许Windows 共享运行程序使用 Mono,而不是使用 docker (linux) 映像,因为这导致我在 Windows 执行上遇到一些问题。
对于 mac 部分,我在 gitlab 上启动发布阶段之前在我的计算机上注册了 gitlab 运行程序。
我认为您可以通过 Travis 快速获得相同的结果,他已经提供了mac和windows运行程序。
我希望我对你有帮助。祝你好运
| 归档时间: |
|
| 查看次数: |
16373 次 |
| 最近记录: |