[fork] A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box (Forked from https://github.com/electron-userland/electron-builder)
Find a file
2025-04-23 11:04:57 -07:00
.changeset feat: customNsisResources override in nsis options (#9032) 2025-04-23 11:04:57 -07:00
.github chore(deps): update jsmrcaga/action-netlify-deploy action to v2.4.0 (#8963) 2025-04-12 09:47:04 -07:00
.husky fix: fix husky not create hooks and improve lint when commit (#5716) 2021-03-30 16:08:33 -07:00
.idea chore: migrate to fs/promises 2021-05-13 18:12:01 +02:00
.vitest-cert chore(test): migrating jest to vitest (#8907) 2025-03-01 10:50:45 -08:00
.vscode chore(refactor): explore parallelization of builds (#8962) 2025-03-26 08:53:30 -07:00
docker chore: update dockerfile node images to LTS (#8927) 2025-03-09 15:00:33 -07:00
packages feat: customNsisResources override in nsis options (#9032) 2025-04-23 11:04:57 -07:00
pages fix(mac): allow ad-hoc identities for codesigning (#9007) 2025-04-09 20:45:43 -07:00
patches fix(deploy): downgrade changesets/cli to 2.25.0 (#8574) 2024-10-08 20:01:40 -07:00
scripts chore(test): migrating jest to vitest (#8907) 2025-03-01 10:50:45 -08:00
test fix: dependency path is undefined (#9013) 2025-04-12 08:22:23 +08:00
typings fix: allow typescript typechecking for electron-updater .d.ts (#8372) 2024-07-23 13:52:15 -07:00
.editorconfig chore: get rid of yarn 2 and migrate to pnpm, update deps, require no… (#5710) 2021-03-15 18:33:42 +01:00
.gitignore chore(test): migrating jest to vitest (#8907) 2025-03-01 10:50:45 -08:00
.mention-bot chore: rc-producer.yml for IDEA, mention bot config, update deps 2016-12-05 08:12:50 +01:00
.npmrc chore: Only publish electron-builder & electron-updater tags (#6595) 2022-01-30 12:02:49 -08:00
.nvmrc chore: update dockerfile node images to LTS (#8927) 2025-03-09 15:00:33 -07:00
.prettierignore chore: integrate prettier (#5680) 2021-03-10 14:55:23 +01:00
.prettierrc.yaml chore: change printWidth from 250 to 180 (#5714) 2021-03-15 19:47:36 +01:00
CHANGELOG.md chore(deploy): Release v26.0.13 (electron-updater@6.6.3) (#8988) 2025-04-11 22:12:09 -07:00
CONTRIBUTING.md chore: removing dead files, balance CI usage, updating issue template (#8821) 2025-01-30 08:17:24 -08:00
eslint.config.mjs fix: allow skipLibCheck: false (#8813) 2025-01-27 14:26:04 -08:00
LICENSE Initial commit 2015-05-21 09:45:02 +02:00
mkdocs-dockerfile chore: migrate documentation site from Netlify app to GHA w/ docker image (#8629) 2024-11-02 16:30:08 -07:00
mkdocs.yml chore(docs): change code signing doc url to google-indexed url (#8790) 2025-01-20 16:52:18 -08:00
netlify.toml fix: dmg-license-dependency (#6248) 2021-09-10 08:03:42 -07:00
package.json chore(test): migrating jest to vitest (#8907) 2025-03-01 10:50:45 -08:00
pnpm-lock.yaml chore(deps): updating electron/rebuild to latest 3.7.2 (#9022) 2025-04-10 15:36:33 -07:00
pnpm-workspace.yaml chore: get rid of yarn 2 and migrate to pnpm, update deps, require no… (#5710) 2021-03-15 18:33:42 +01:00
README.md chore(docs): fix various broken links (#8937) 2025-03-05 08:15:06 -08:00
run-tests-in-docker-custom-app-builder.sh fix: updating app-builder dependency (#8353) 2024-07-18 14:55:56 -07:00
tsconfig-base.json chore: get rid of yarn 2 and migrate to pnpm, update deps, require no… (#5710) 2021-03-15 18:33:42 +01:00
tsconfig.json chore(docs): Updating/migrating docs branch and automating docs deployment (#6221) 2021-09-02 14:17:24 -07:00
typedoc.config.js chore(docs): fixing indentation of typedoc and TOC depth/padding (#8657) 2024-11-02 17:43:42 -07:00
vite.config.ts chore(test): parallel test execution! 🏎️ (#8919) 2025-03-07 21:02:25 -08:00

electron-builder npm version downloads per month donate

A complete solution to package and build a ready for distribution Electron, Proton Native app for macOS, Windows and Linux with “auto update” support out of the box. :shipit:

Always looking for community contributions! 👀 Setting up a dev environment is easy to do 🪩

Sponsors

WorkFlowy
Notes, Tasks, Projects.
All in a Single Place.


Tidepool
Your gateway to understanding your diabetes data


Keygen
An open, source-available software licensing and distribution API


ToDesktop
ToDesktop: An all-in-one platform for building and releasing Electron apps


Dashcam
Dashcam: Capture the steps to reproduce any bug with video crash reports for Electron.

Documentation

See the full documentation on electron.build.

  • NPM packages management:
  • Code Signing on a CI server or development machine.
  • Auto Update ready application packaging.
  • Numerous target formats:
    • All platforms: 7z, zip, tar.xz, tar.7z, tar.lz, tar.gz, tar.bz2, dir (unpacked directory).
    • macOS: dmg, pkg, mas.
    • Linux: AppImage, snap, debian package (deb), rpm, freebsd, pacman, p5p, apk.
    • Windows: nsis (Installer), nsis-web (Web installer), portable (portable app without installation), AppX (Windows Store), MSI, Squirrel.Windows.
  • Publishing artifacts to GitHub Releases, Amazon S3, DigitalOcean Spaces and Bintray.
  • Advanced building:
    • Pack in a distributable format already packaged app.
    • Separate build steps.
    • Build and publish in parallel, using hard links on CI server to reduce IO and disk space usage.
    • electron-compile support (compile for release-time on the fly on build).
  • Docker images to build Electron app for Linux or Windows on any platform.
  • Proton Native support.
  • Downloads all required tools files on demand automatically (e.g. to code sign windows application, to make AppX), no need to setup.
Question Answer
“I want to configure electron-builder” See options
“I found a bug or I have a question” Open an issue
“I want to support development” Donate

Installation

Yarn is strongly recommended instead of npm.

yarn add electron-builder --dev

Note for Yarn 3

Yarn 3 use PnP by default, but electron-builder still need node-modules(ref: yarnpkg/berry#4804). Add configuration in the .yarnrc.yaml as follows:

nodeLinker: "node-modules"

will declare to use node-modules instead of PnP.

Quick Setup Guide

electron-webpack-quick-start is a recommended way to create a new Electron application. See Boilerplates.

  1. Specify the standard fields in the application package.json — name, description, version and author.

  2. Specify the build configuration in the package.json as follows:

    "build": {
      "appId": "your.id",
      "mac": {
        "category": "your.app.category.type"
      }
    }
    

    See all options. Option files to indicate which files should be packed in the final application, including the entry file, maybe required. You can also use separate configuration files, such as js, ts, yml, and json/json5. See read-config-file for supported extensions. JS Example for programmatic API

  3. Add icons.

  4. Add the scripts key to the development package.json:

    "scripts": {
      "app:dir": "electron-builder --dir",
      "app:dist": "electron-builder"
    }
    

    Then you can run yarn app:dist (to package in a distributable format (e.g. dmg, windows installer, deb package)) or yarn app:dir (only generates the package directory without really packaging it. This is useful for testing purposes).

    To ensure your native dependencies are always matched electron version, simply add script "postinstall": "electron-builder install-app-deps" to your package.json.

  5. If you have native addons of your own that are part of the application (not as a dependency), set nodeGypRebuild to true.

Please note that everything is packaged into an asar archive by default.

For an app that will be shipped to production, you should sign your application. See Where to buy code signing certificates.

Programmatic Usage

See node_modules/electron-builder/out/index.d.ts. Typings for TypeScript are provided and also can be found here.

Code snippet provided below is also shown "in action" here as well.

"use strict"

const builder = require("electron-builder")
const Platform = builder.Platform

// Promise is returned
builder.build({
  targets: Platform.MAC.createTarget(),
  config: {
   "//": "build options, see https://goo.gl/QQXmcV"
  }
})
  .then(() => {
    // handle result
  })
  .catch((error) => {
    // handle error
  })

Boilerplates

Debug

Set the DEBUG environment variable to debug what electron-builder is doing:

DEBUG=electron-builder

FPM_DEBUG env to add more details about building linux targets (except snap and appimage).

DEBUG_DMG=true env var to add more debugging/verbosity from hdiutil (macOS).

!!! tip "cmd" On Windows the environment variable is set using the set command. bash set DEBUG=electron-builder

!!! tip "PowerShell" PowerShell uses different syntax to set environment variables. bash $env:DEBUG=electron-builder

Donate

We do this open source work in our free time. If you'd like us to invest more time on it, please donate.