admin管理员组文章数量:1295910
Can somebody explain to me how electron-builder config work? I can't understand 95% of the things. Everything bellow API is somehow confusing. There are 0 examples of actually how something should be added to the build
object. I mean, look at a simple dev request: I want to create windows and linux build. I copy/paste-ed some code and I came out with the fillowing:
{
"name": "Test",
"version": "1.0.0",
"author": "Test Ltd.",
"description": "Test",
"devDependencies": {
...
},
"build": {
"appId": "Test",
"extraFiles": {
"from": "./build",
"to": "./dist"
},
"win": {
"icon" : "build/images/icon.ico",
"target": ["portable"]
},
"linux": {
"icon" : "build/images/icon.png",
"target": ["pacman"]
}
},
"scripts": {
"pack": "build --dir",
"dist": "build"
}
}
- It creates only x64 windows package. In the
dist
folder there is a folder calledwin-unpacked
and one .exe file. The linux package is not there. Why? - How to specify the arch (x64, x32)?
- How to use the things bellow API? I understood only how
WinBuildOptions
work - I should write "win" in the "build" object ofpackage.json
. - What is
Squirrel Events
? I red this, but can't understand it from plain text. - Any remendations for a video guide for "How to create an installer for Windows with Electron/electron-builder?" or "How to create package for Linux and upload it online so people with Linux can download it with Electron/electron-builder?" I couldn't find any.
Can somebody explain to me how electron-builder config work? I can't understand 95% of the things. Everything bellow API is somehow confusing. There are 0 examples of actually how something should be added to the build
object. I mean, look at a simple dev request: I want to create windows and linux build. I copy/paste-ed some code and I came out with the fillowing:
{
"name": "Test",
"version": "1.0.0",
"author": "Test Ltd.",
"description": "Test",
"devDependencies": {
...
},
"build": {
"appId": "Test",
"extraFiles": {
"from": "./build",
"to": "./dist"
},
"win": {
"icon" : "build/images/icon.ico",
"target": ["portable"]
},
"linux": {
"icon" : "build/images/icon.png",
"target": ["pacman"]
}
},
"scripts": {
"pack": "build --dir",
"dist": "build"
}
}
- It creates only x64 windows package. In the
dist
folder there is a folder calledwin-unpacked
and one .exe file. The linux package is not there. Why? - How to specify the arch (x64, x32)?
- How to use the things bellow API? I understood only how
WinBuildOptions
work - I should write "win" in the "build" object ofpackage.json
. - What is
Squirrel Events
? I red this, but can't understand it from plain text. - Any remendations for a video guide for "How to create an installer for Windows with Electron/electron-builder?" or "How to create package for Linux and upload it online so people with Linux can download it with Electron/electron-builder?" I couldn't find any.
- Hi Marin, I have same problem already couple of days, I couldn't understand how to configure electron builder to make my apps' installer... If you found any good articles please link it below. Thank you : ) – Vano Commented Jun 5, 2019 at 12:56
- What most helped me was the answers bellow. I couldn't find any good articles/github of how to config the app. It's sad really. All I had in the end was windows installer. One thing I would like to mention here is that if you want you app to be updated, the user will have to uninstall the old app and install the new one. Back in 2017 I wanted the updates to be patch-like, but this was not supported. I don't know if they support this now. – Marin Takanov Commented Jun 7, 2019 at 7:38
- Fast forward 6 years to today and the documentation still isn't helpful at all. – Franco Commented Aug 16, 2023 at 11:07
2 Answers
Reset to default 4Take a look a the api options in the github repo for electron-builder, which uses the windows build options and linux build options to work. The descriptions of each item are laid out next to the attribute/property of the config.
This is a contrived example, but should at least give the structure of how it should look for windows and linux:
"build":{
"appid":"yourid",
"asar": true
"linux":{
"category": "...",
"target": "..."
},
"win":{
"target": "...",
"certificateFile":"...",
"publisherName": "..."
}
}
There is a multi platform build page you can review. Specifically, to target a certain arch, you use the mand line flags. From the documentation:
By default build for current platform and current arch. Use CLI flags --mac, --win, --linux to specify platforms. And --ia32, --x64 to specify arch.
Typically, this is specified as an npm script, and passed along that way when you run the electon-build mand. In terms of building on platforms and potentially missing information, please see this quote:
Don't expect that you can build app for all platforms on one platform.
There appears to be extra setup and configuration needed to develop a linux and windows version based on the specific OS you are using. I would look at what that page states in terms of dependencies.
To answer part of your question you can not package an app when you are not on the platform that you want to package for example if you are on window the electron-builder will package windows app based on the machine you are using configuration of win targets
For linux targets, see here. The remendation seems to be to build inside a docker container if you want to build for linux.
本文标签: javascriptElectron electronbuilder configStack Overflow
版权声明:本文标题:javascript - Electron: electron-builder config - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741580309a2386532.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论