gitwtfhub

electron-userland/electron-builder

14,557TypeScriptAudience · developerComplexity · 3/5ActiveSetup · moderate

TL;DR

Packaging tool for Electron and Proton Native apps that produces signed Mac, Windows, and Linux installers, handles auto update, and publishes to common artifact stores.

Mindmap

mindmap
  root((electron-builder))
    Inputs
      Electron source
      package.json build config
      Code signing certs
    Outputs
      dmg pkg mas
      nsis msi appx
      AppImage deb rpm snap
      Auto update feed
    Use Cases
      Ship desktop app
      CI release pipeline
      Auto updating clients
    Tech Stack
      TypeScript
      Node
      Electron
      Docker
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why anyone would actually build this

REASON 1

Package an Electron app into platform installers like dmg, nsis, AppImage, and snap

REASON 2

Wire code signing and auto update into a CI release pipeline

REASON 3

Publish finished artifacts to GitHub Releases, S3, or DigitalOcean Spaces

REASON 4

Cross compile Windows and Linux builds from any host using Docker

Stack

TypeScriptNodeElectronDocker

Spinning it up

Difficulty · moderate Time to first run · 1h+

Code signing certificates and platform specific tooling are the main hurdle, especially when targeting Windows and Mac from a single CI host.

Wtf does this do

electron-builder is a tool for packaging desktop apps that were built with Electron, the framework that lets developers create Mac, Windows, and Linux apps using web technology. It also works with Proton Native. Once a developer has the code for an Electron app, electron-builder turns that code into the kind of installer file a normal user would download and double-click. It ships with built-in support for "auto update" so finished apps can pull in new versions on their own. The project covers a long list of output formats. For Mac it can produce dmg, pkg, and mas builds. For Windows it produces nsis installers, web installers, portable apps, AppX bundles for the Windows Store, MSI, and Squirrel.Windows. For Linux it produces AppImage, snap, deb, rpm, freebsd, pacman, p5p, and apk packages. There are also generic archive formats like 7z, zip, and various tar variants that work on all platforms. A lot of what electron-builder does is the awkward plumbing around shipping a desktop app. It handles code signing on a continuous integration server or a developer machine, compiles native Node modules so they match the target platform, and downloads the extra tools it needs on demand so the developer does not have to install them by hand. It can publish the finished artifacts to GitHub Releases, Amazon S3, DigitalOcean Spaces, or Bintray, and it can build Linux or Windows apps from any host machine using Docker images. Using it is mostly a matter of adding electron-builder as a dev dependency through yarn, npm, pnpm, or bun, then writing a "build" section inside the project's package.json. That section sets things like the application id, the Mac category, and which files should be included. The README points to electron-webpack-quick-start as a recommended way to scaffold a new project, plus a documentation site at electron.build for the full configuration reference.

Yoink these prompts

Prompt 1
Show me a minimal package.json build section for an Electron app that targets dmg, nsis, and AppImage
Prompt 2
Walk me through code signing an Electron app on GitHub Actions using electron-builder
Prompt 3
Explain how the auto update feed produced by electron-builder is consumed by the running app
Prompt 4
Help me debug why my native node module fails to load after electron-builder packages it
View the repo → Decode another repo

← electron-userland on gitmyhub — every repo by this author, as a profile.

Don't trust strangers blindly. Verify against the repo.