简体   繁体   English

在 Windows、Mac 和 Linux 上分发 Electron 应用程序

[英]Distributing an Electron app on Windows, Mac and Linux

I've spend my weekend experimenting with Electron and this caused a few questions and dilemmas in my head.我花了我的周末来试验 Electron,这在我的脑海中引起了一些问题和困境。

I cloned the following Github repository to test with: electron-vue-typescript-starter我克隆了以下 Github 存储库进行测试: electron-vue-typescript-starter

This project uses electron-builder to build the project, based on the host platform you're developing on.该项目使用electron-builder来构建项目,基于您正在开发的主机平台。 Since I'm developing on Windows it builds an .exe file.由于我在 Windows 上开发,它构建了一个.exe文件。

Apart from the .exe there are also some other files.除了.exe之外,还有一些其他文件。 The following files were made by electron-builder on windows :以下文件是由electron-builderwindows上制作的:

| win-unpacked
|--- (lots of DDL's + electron-application.exe)

--- electron-builder.yaml  
--- electron-application setup 0.0.0.exe
--- electron-application setup 0.0.0.exe.blockmap
--- latest.yml

Question 1: If I want to distribute the application for public usage, what should users download?问题1:如果我想分发应用程序供公众使用,用户应该下载什么? The .exe setup only?.exe设置? Or do they need some/all of the other files aswell?还是他们还需要一些/所有其他文件?

After setting up a macOS VM I've managed to build the application for the darwin platform too.在设置了 macOS 虚拟机之后,我也设法为darwin平台构建了应用程序。 The following files were made by electron-builder on darwin :以下文件是由electron-builderdarwin上制作的:

| github
|--- latest-mac.json
| mac
|--- electron-application.app

--- electron-builder.yaml  
--- electron-application-0.0.0-mac.zip
--- electron-application-0.0.0.dmg
--- electron-application-0.0.0.dmg.blockmap
--- latest-mac.yml

Question 2: What do the users need from above to use/install the application on the darwin platform?问题2:用户在darwin平台上使用/安装应用程序需要什么?

Question 3: I haven't build the application for linux yet.问题 3:我还没有为linux构建应用程序。 But how do I distribute the linux edition?但是我如何分发linux版本? Would this be similar to the darwin one?这会类似于darwin的吗?

Note: I have read some parts of the electron-builder documentation but it it's really abstract and doesn't explain (as far as I could see) how someone would distribute the build contents.注意:我已经阅读了electron-builder文档的某些部分,但它确实很抽象,并且没有解释(据我所知)有人将如何分发构建内容。

The cleanest way would be a single .exe file for windows and a single .zip or .dmg for darwin .最干净的方法是一个用于windows.exe文件和一个用于darwin.zip.dmg文件。 But what are the other files for?但是其他文件是做什么用的? What should I do with them, because they are there for a reason, right?我应该怎么处理他们,因为他们在那里是有原因的,对吧?

For distribution, you need to provide an installer (msi) for windows user.对于分发,您需要为 Windows 用户提供安装程序 (msi)。

  • You need to follow below link, which will answer all your questions.您需要点击以下链接,它将回答您的所有问题。

electron-packager-tutorial 电子包装器教程

electron-windows-installer 电子窗口安装程序

Above tutorial also provide information about creating Debian package.上面的教程还提供了有关创建 Debian 软件包的信息。

You will need to serve them with the entire folder contents.您将需要为它们提供整个文件夹内容。 When they run the .exe, it references the other files to complete the installation当他们运行 .exe 时,它​​会引用其他文件来完成安装

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM