In this lesson, we are going to learn how to package an electron application using electron-builder and distribute this application using GitHub releases.

In the previous lessons, we learned how to create Electron applications and how to use electron-weback to bundle the application source. So far, we haven’t packaged the application as we were only running the application using either the $ electron or $ electron-webpack commands.In this lesson, we are going to create distribution files for an Electron application such as .dmg or .pkg for macOS or .msi for Windows and host them right on our GitHub repository. This will allow our users to download the platform-specific installation file of the application.There are many tools to package an Electron application but electron-builder is one of the most popular ones. We are going to use the same old electron-lessons repository we have created that contains the source code of the Electron applications we have created in the previous lessons.We are going to use the file-io branch used in this lesson. The file-io branch contains a simple Electron application with the proper directory structure so we would get a clear idea of how to use electron-builder with the custom directory structure.

What is electron-builder?

electron-builder is a CLI tool that helps us create multi-platform distributions for Electron applications. It supports macOS, Windows, and Linux targets out of the box. It supports multiple file formats for each of these platforms such as dmgpkgmas and, mas-dev for macOS.Once these build artifacts are produced by electron-builder, it can automatically publish them on GitHub (through GitHub releases), Amazon S3, and other cloud providers. This is one of the best features for us open-source developers as we normally host the application binaries on GitHub.Another great feature of electron-builder is auto-update support. For example, if we update the Electron applications on GitHub releases, the users who have installed the application would get a prompt to update the application automatically. This saves us a ton of cost and time to host a standalone service to dispatch update events for the application.electron-builder provides other cool features such as native add-ons compilation, dependency management, etc. To know more about these features, read this documentation. We are going to discuss some of these features in this lesson.

#nodejs #electronjs #software-development

Packaging and Distributing Electron Applications using Electron-builder
1.60 GEEK