Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@electron-forge/cli
Advanced tools
@electron-forge/cli is a command-line interface tool that simplifies the process of building, packaging, and distributing Electron applications. It provides a set of commands to streamline the development workflow for Electron apps.
Project Initialization
This command initializes a new Electron project with a template structure, setting up the necessary configuration and dependencies to get started quickly.
npx electron-forge init my-new-app
Building the Application
This command builds the Electron application into distributable formats (e.g., .exe, .dmg) for different operating systems, using pre-configured or custom build targets.
npx electron-forge make
Running the Application
This command starts the Electron application in development mode, allowing developers to test and debug their app in a live environment.
npx electron-forge start
Publishing the Application
This command automates the process of publishing the Electron application to distribution platforms, such as GitHub Releases or other configured targets.
npx electron-forge publish
electron-builder is a powerful tool for building and packaging Electron applications. It offers a wide range of configuration options and supports multiple platforms. Compared to @electron-forge/cli, electron-builder is more focused on the packaging and distribution aspects, providing extensive customization for build processes.
electron-packager is a simple tool for packaging Electron applications. It focuses on creating distributable binaries for different platforms. While it is less feature-rich than @electron-forge/cli, it is a lightweight option for developers who need basic packaging capabilities without additional setup.
electron-webpack is a tool that integrates Webpack with Electron development, providing a modern build system for Electron apps. It is more focused on the development and build process, offering advanced features like hot module replacement. Compared to @electron-forge/cli, it requires more configuration but offers greater flexibility for developers familiar with Webpack.
Electron forge's CLI is separate from the core module, to install it you will have to use the @electron-forge/cli
module from NPM.
# NPM
npm i -g @electron-forge/cli
# Yarn
yarn global add @electron-forge/cli
At a high level the CLI module is just a proxy to the raw API commands. Almost all the configuration is still done in your Forge Config, the CLI just provides a handy way to trigger all the core functionality of Electron Forge (and you should definitely use it).
Please note these commands are sorted in alphabetical order, the ones you probably need to care about are start, package, make and publish.
Maps to electronForge.import
, will attempt to take an existing Electron app and make it Forge compatible. Normally this is just creates a base forge config and adds the required dependencies.
There are no flags for the Import command
Maps to electronForge.init
, will initialize a new Forge powered application in the given directory (defaults to .
).
Please note if you want to use a template it must be installed globally before running the init
command.
Flag | Value | Required | Description |
---|---|---|---|
--template | Template Name | No | Name of the template to use to make this new app |
--copy-ci-files | N/A | No | Set if you want to copy templated CI files for Travis CI and Appveyor |
Maps to electronForge.install
, will attempt to install the Electron app that is published at the given GitHub repository. This command is just a helper for installing other applications quickly. E.g.
electron-forge install atom/atom
Maps to electronForge.lint
, will run the lint
command that your package.json
exposes. If the exit code is 0 no output is shown, otherwise the error output will be displayed.
There are no flags for the Lint command
Maps to electronForge.make
, will make distributables for your application based on your forge config and the parameters you pass in.
Flag | Value | Required | Description |
---|---|---|---|
--arch | Architecture E.g. x64 | No | Target architecture to make for |
--platform | Platform E.g. mas | No | Target platform to make for, please note you normally can only target platform X from platform X |
--targets | Comma separated list of maker names | No | Override your make targets for this run |
--skip-package | N/A | No | Set if you want to skip the packaging step, useful if you are running sequential makes and want to save time |
Maps to electronForge.package
, will package your application into a platform specific format and put the result in a folder. Please note that this does not make a distributable format, to make proper distributables please use the make command.
Flag | Value | Required | Description |
---|---|---|---|
--arch | Architecture E.g. x64 | No | Target architecture to package for. Defaults to the host arch. |
--platform | Platform E.g. mas | No | Target platform to package for. Defaults to the host platform. |
Maps to electronForge.publish
, will attempt to make the forge application and then publish it to the publish targets defined in your forge config.
If you want to publish previously created make
artifacts you will have to use the dry-run
options explained below.
Flag | Value | Required | Description |
---|---|---|---|
--target | Comma separated list of publisher names | No | Override your publish targets for this run |
--dry-run | N/A | No | Triggers a publish dry run which saves state and doesn't upload anything |
--from-dry-run | N/A | No | Attempts to publish artifacts from any dry runs saved on disk |
Maps to electronForge.start
, will launch the Forge powered application in the given directory (defaults to .
).
If you type rs
(and hit enter) in the same terminal where you ran the start command, the running app will be terminated and restarted.
Flag | Value | Required | Description |
---|---|---|---|
--app-path | Path to your app from CWD | No | Override the path to the Electron app to launch (defaults to . ) |
--enable-logging | N/A | No | Enable advanced logging. This will log internal Electron things |
--run-as-node | N/A | No | Run the Electron app as a Node.JS script |
--inspect-electron | N/A | No | Triggers inspect mode on Electron to allow debugging the main process |
FAQs
A complete tool for building modern Electron applications
The npm package @electron-forge/cli receives a total of 118,169 weekly downloads. As such, @electron-forge/cli popularity was classified as popular.
We found that @electron-forge/cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.