@rabbitholesyndrome/electron-forge-maker-portable
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Electron Forge Maker Portable

Electron Forge Maker for portable Windows apps

Electron Forge Maker Portable is a Maker plugin for Electron Forge that allows you to bundle your Electron files into a single standalone & portable .exe file on Windows.

Installation

yarn add -D @rabbitholesyndrome/electron-forge-maker-portable

or

npm install --save-dev @rabbitholesyndrome/electron-forge-maker-portable

Usage

Add it to your electron-forge Maker config:

{
  "config": {
    "forge": {
      "makers": [
        {
          "name": "@rabbitholesyndrome/electron-forge-maker-portable"
        }
      ]
    }
  }
}

Then run electron-forge make:

yarn make
# or `yarn electron-forge make`

or

npm run make
# or `npx electron-forge make`

Background

In electron-forge, the only built-in way to package Windows binaries is using the Squirrel.Windows Maker. Why do we need to package Electron apps? Electron requires a bunch of extra files and dependencies (eg. .dll files) in order for the .exe file to run, so we need a way to distribute all of these files together.

Squirrel.Windows works great if you are okay with an "installer" .exe that unpacks all the files to a location on the user's PC. If you wish to have a single portable .exe instead, this will not work.

Other Electron tools like electron-builder support additional targets on top of Squirrel.Windows, specifically NSIS (Nullsoft Scriptable Install System). NSIS is capable of bundling all of the Electron files into a single portable .exe file.

This plugin injects electron-builder's NSIS portable builder logic into electron-forge as a Maker plugin so that you can build portable .exe files while staying within the Electron Forge ecosystem.

Config

This Maker accepts a config property. Anything passed to config will get merged into electron-builder's configuration before it is executed by electron-builder:

{
  "config": {
    "forge": {
      "makers": [
        {
          "name": "@rabbitholesyndrome/electron-forge-maker-portable",
          "config": {
            "appId": "com.example.app"
          }
        }
      ]
    }
  }
}

Specifically you might be interested in the nsis/portable config options:

{
  "config": {
    "forge": {
      "makers": [
        {
          "name": "@rabbitholesyndrome/electron-forge-maker-portable",
          "config": {
            "portable": {
              "artifactName": "${productName}-app-${version}.${ext}"
            }
          }
        }
      ]
    }
  }
}

Please see the electron-builder documentation for all the configuration options available.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @rabbitholesyndrome/electron-forge-maker-portable

Weekly Downloads

216

Version

0.2.0

License

MIT*

Unpacked Size

73.8 kB

Total Files

10

Last publish

Collaborators

  • gregnr