Sergio Vilar

writes about dev stuff

Building an Electron application for OSX, Windows and Linux

15 Sep 2015

To package your Electron application we’ll use a nodejs script that could be customized for codesign and/or CI purposes.

First we need to install the dependencies:

npm install —save-dev electron-packager shelljs

Create a file named pkg.js in your project’s root:

Usage

To package only for osx, run:

node pkg.js —platform=darwin

To pagkage for all platforms:

node pkg.js —all

To package only for the current platform:

node pkg.js

Customization

This script allows you customize the build for specific platform/architeture. For instance, you can push a codesign command to cmds if the platform is darwin:

if(plat === 'darwin'){
  cmds.push('codesign command');
}