Importing an Existing Project
Import an existing Electron project to use Electron Forge.
If you already have an Electron app and want to try out Electron Forge, you can either use Forge's import
script or manually configure Forge yourself.
These steps will get you set up with a basic build pipeline that can create Squirrel.Windows (Windows), ZIP (macOS), and deb (Linux) installers when running electron-forge make
.
Using the import script
Importing an existing Electron app into the Electron Forge workflow can be done automatically using Forge's import
command.
This script will set up Forge to package your app and build installers for it.
If you're already using other Electron tooling, it will try to automatically migrate the settings as much as possible, but some of it may need to be migrated manually.
Setting up Forge manually
If the import script does not work for some reason, you can also install Forge manually. To get identical behavior to the script, follow the steps below.
Installing dependencies
First, install Forge's CLI and the target Makers as devDependencies in your project.
Configuring package.json
To start using Forge, add a few command scripts to your package.json file:
Then, set up your Forge Overview in the config.forge
field in package.json.
In the above object, we configure each Maker that we installed into the makers
array. We also create an empty packagerConfig
object that you should edit to your app's packaging needs.
Adding Squirrel.Windows boilerplate
When distributing a Squirrel.Windows app, we recommend installing electron-squirrel-startup
as a runtime dependency to handle Squirrel events.
Then, add the following snippet as early as possible in the main process execution (before the app.ready
event).
Optional: publishing your app
You can also configure Forge to upload your release artifacts to a self-hosted release server such as Electron Release Server or Nucleus, or cloud storage providers such as S3.
For example, for the S3 Publisher:
See the Publishers documentation for more information.
Last updated