electron /build-tools

The GN scripts to use for Electron dev-flows

★ 299⑂ 85👁 12⑃ 740● 187▤ 0
TypeScriptMITCreated 2018-10-13
TA的项目
+0
日增长
+1
周增长
299
stars
85
forks
12
watchers
740
prs
187
issues
0
releases

README

Electron Build Tools

This repository contains helper/wrapper scripts to make building Electron easier.

 Table of Contents

- Installation
- Quickstart
- Concepts
- Core workflow: init · sync · build
- Running Electron: start · node · debug · test · npm
- Inspecting state: show · shell
- Working with code: patches · patch-merge-driver · register-patches-merge-driver · open · pr · download-dist · backport · cherry-pick · rcv · auto-roll
- Managing configs: use · remove · sanitize-config · worktree · load-macos-sdk
- Infrastructure: depot-tools · gh-auth · auto-update
- Configuration file reference
- Environment variables
- Shell completion
- Advanced

 Installation

A handful of prerequisites, such as git, python, and npm, are required for building Electron itself;
these can be found in [Platform Prerequisites][platform-prerequisites]. npm can be used with
build-tools itself as well, but we've configured it to run with yarn, so we also recommend you
install it to your system.

From here, you'll need a command-line prompt. On Mac and Linux, this will be a terminal with a
shell, e.g. bash or zsh. You can also use these on Windows if you install them, or use built-in
tools like Windows' Command Prompt.

Please note that build-tools (due to nested dependencies) might not work properly in PowerShell;
please use cmd on Windows for optimum results.

sh
 Install build-tools package globally:
npm i -g @electron/build-tools


 [!NOTE]
 The @electron/build-tools npm package is a thin wrapper for the actual build-tools scripts.
 Its code lives in the electron/build-tools-installer repository.

 Quickstart

sh
 The 'Hello, World!' of build-tools: get and build main
 Choose the directory where Electron's source and build files will reside.
 You can specify any path you like; this command defaults to $PWD/electron.
 If you're going to use multiple branches, you may want something like:
 --root=~/electron/branch (e.g. ~/electron-gn/main)
e init --root=~/electron --bootstrap testing


That command's going to run for awhile. While you're waiting, grab a cup of hot caffeine and read
about what your computer is doing.

 Concepts

Electron's build-tools command is named e. Like [nvm][nvm] and git, you'll invoke e with
commands and subcommands. See e --help or e help  for more details on any command.

e also borrows another inspiration from nvm: having multiple configurations that you can switch
between so that one is the current, active configuration. Many choices go into an Electron build:

- Which Electron branch is used (e.g. main, 36-x-y)
- Which [.gn config file][gn-configs] is imported (e.g. testing or release)
- Any compile-time options (e.g. Clang's [asan or tsan][sanitizers])

e holds all these variables together in a build configuration. You can have multiple build
configurations and manage them in a way similar to nvm:

| nvm                  | e                  | Description                                    |
|:---------------------|:------------------

Top issues

Snapshot: 2026-11-27T22:26:53Z · Data license Apache-2.0 · JSON