Skip to content

TwilightCoders/electron-global

 
 

Repository files navigation

electron-global

Travis Downloads PayPal Discord

A tool for building lightweight Electron apps using a global Electron instance. Forget about 100MB for a Hello World app in Electron!

How it works?

electron-global creates a custom Electron distributable with a small app launcher which checks the app's package.json and downloads corresponding major version and the newest in case of minor and patch. The Electron versions are being saved to:

  • on macOS and Linux: ~/.electron-global/x
  • on Windows: %HOMEPATH%/.electron-global/x

Where x is the major version of Electron (e.g. 6).

Then the distributable can be used with electron-builder to build the app installers.

Installation

The electron-builder package is also required to successfully build an app.

$ npm install --save-dev electron-global electron-builder

Usage

You need to create electron-builder.json file in your project directory, configure it and specify electronDist directory to where the electron-global generates the output (default is ./electron-global). Example:

{
  ...
  "electronDist": "./electron-global"
  ...
}

Then you can run the following command (example for macOS):

$ electron-global -m && electron-builder -m

CLI Options:

Usage: electron-global [options]

Options:
  -m, --mac                Create Electron dist for macOS.
  -l, --linux              Create Electron dist for Linux.
  -w, --windows            Create Electron dist for Windows.
  -o, --output <path>      Output path of the created Electron runtime launcher. Defaults to `./dist/runtime`.
  --projectDir, --project  The path to project directory. Defaults to current working directory.
  -h, --help               output usage information

Known limitations

  • electronDist also applies to rebuilding native modules, therefore these won't work.
  • It does not remove unused Electron versions.
  • Apps will be listed in task managers as Electron, not as processes with the actual app name and icon.

About

One Electron instance for multiple apps

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 95.7%
  • TypeScript 2.7%
  • Other 1.6%