LinuxCommandLibrary

electron-packager

Package Electron apps for distribution

TLDR

Package an application for the current architecture and platform

$ electron-packager "[path/to/app]" "[app_name]"
copy

Package an application for all architectures and platforms
$ electron-packager "[path/to/app]" "[app_name]" --all
copy

Package an application for 64-bit Linux
$ electron-packager "[path/to/app]" "[app_name]" --platform="[linux]" --arch="[x64]"
copy

Package an application for ARM macOS
$ electron-packager "[path/to/app]" "[app_name]" --platform="[darwin]" --arch="[arm64]"
copy

SYNOPSIS

electron-packager source_dir app_name platform arch [options]

PARAMETERS

source_dir
    The path to the application's source code.

app_name
    The name of the application.

platform
    The target platform (e.g., linux, win32, darwin).

arch
    The target architecture (e.g., x64, ia32, arm64).

--out=


    The directory to place the packaged application(s).

--version=
    The Electron version to use.

--overwrite
    If the output directory already exists, replace it.

--icon=
    Path to the application icon.

--package-manager=
    The package manager to use for installing dependencies.

DESCRIPTION

electron-packager is a command-line tool that automates the process of creating application bundles for Electron apps. It takes your Electron application source code and packages it into a ready-to-distribute format for the Linux operating system.

This involves bundling your application's JavaScript, HTML, CSS, and other assets along with a prebuilt Electron binary. The tool handles architecture targeting (e.g., x64, i386, arm64) and provides options for customizing the application's name, icon, version, and other metadata. It simplifies the distribution process by creating self-contained application packages. It generates output bundles that can be installed and run on Linux distributions without requiring users to install Node.js or Electron separately. electron-packager supports generating .zip, .tar.gz, .deb, .rpm, and AppImage formats, depending on which are specified by the user.

CAVEATS

Requires Node.js and npm to be installed. Must have write permissions to the output directory.

EXAMPLE

electron-packager ./my-app MyApp linux x64 --out=./dist --version=27.0.0
This command packages the Electron application in the 'my-app' directory for Linux x64 architecture, places the output in the 'dist' directory, and uses Electron version 27.0.0.

HISTORY

electron-packager emerged as a response to the growing need for streamlined Electron application packaging. Before its existence, developers had to manually configure and bundle their Electron apps, a process that was often time-consuming and error-prone. The tool provided a faster and easier way to create cross platform packaged applications. It has evolved over time to support various target platforms, architectures, and packaging formats.

SEE ALSO

npm(1), node(1)

Copied to clipboard