7.4.0 • Published 22 days ago

@electron-forge/cli v7.4.0

Weekly downloads
11,161
License
MIT
Repository
github
Last release
22 days ago

description: How to use the command line interface (CLI) for Electron Forge

CLI

Installation

Electron forge's command line interface (CLI) is separate from the core module. To use it you will have to install the @electron-forge/cli module from NPM into your project.

{% tabs %} {% tab title="Yarn" %}

yarn add --dev @electron-forge/cli

{% endtab %}

{% tab title="NPM" %}

npm install --save-dev @electron-forge/cli

{% endtab %} {% endtabs %}

Overview

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 configuration, the CLI just provides a handy way to trigger all the core functionality of Electron Forge.

Commands


ℹ️ These commands are sorted in alphabetical order. The most commonly used are start, package, make, and publish.


Import

Maps to electronForge.import. It will attempt to take an existing Electron app and make it Forge compatible. Normally this just creates a base Electron Forge configuration and adds the required dependencies.

There are no flags for the Import command

Init

Maps to electronForge.init, will initialize a new Forge powered application in the given directory (defaults to ., the current directory).

Please note if you want to use a non-built-in template, it must be installed globally before running the init command.

FlagValueRequiredDescription
--templateTemplate NameNoName of the template to use to make this new app
--copy-ci-filesN/ANoSet if you want to copy templated CI files for Travis CI and Appveyor

Example:

{% tabs %} {% tab title="Yarn" %}

yarn electron-forge init --template=webpack

{% endtab %}

{% tab title="NPM" %}

npx electron-forge init --template=webpack

{% endtab %} {% endtabs %}

Install

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. For example:

npx electron-forge install atom/atom

Lint

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

Make

Maps to electronForge.make, will make distributables for your application based on your Forge config and the parameters you pass in.

FlagValueRequiredDescription
--archArchitecture, e.g. x64NoTarget architecture to make for. Defaults to the arch that you're running on (the "host" arch).
--platformPlatform, e.g. masNoTarget platform to make for, please note you normally can only target platform X from platform X. This defaults to the platform you're running on (the "host" platform).
--targetsComma separated list of maker namesNoOverride your make targets for this run. The maker name is the full node module name, e.g. @electron-forge/maker-deb. By default, the make targets used are the ones available and configured for the given platform.
--skip-packageN/ANoSet if you want to skip the packaging step, useful if you are running sequential makes and want to save time. By default, packaging is not skipped.

Example:

{% tabs %} {% tab title="Yarn" %}

# By default, the make command corresponds to a make npm script:
yarn make --arch=ia32
# If there is no make script:
yarn electron-forge make --arch=ia32

{% endtab %}

{% tab title="NPM" %}

# By default, the make command corresponds to a make npm script:
npm run make -- --arch=ia32
# If there is no make script:
npx electron-forge make --arch=ia32

{% endtab %} {% endtabs %}

Package

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.

FlagValueRequiredDescription
--archArchitecture, e.g. x64NoTarget architecture to package for. Defaults to the host arch.
--platformPlatform, e.g. masNoTarget platform to package for. Defaults to the host platform.

Example:

{% tabs %} {% tab title="Yarn" %}

# By default, the package command corresponds to a package npm script:
yarn package --arch=ia32
# If there is no make script:
yarn electron-forge package --arch=ia32

{% endtab %}

{% tab title="NPM" %}

# By default, the package command corresponds to a package npm script:
npm run package -- --arch=ia32
# If there is no make script:
npx electron-forge package --arch=ia32

{% endtab %} {% endtabs %}

Publish

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.

FlagValueRequiredDescription
--targetComma separated list of publisher namesNoOverride your publish targets for this run
--dry-runN/ANoTriggers a publish dry run which saves state and doesn't upload anything
--from-dry-runN/ANoAttempts to publish artifacts from any dry runs saved on disk

Example:

{% tabs %} {% tab title="Yarn" %}

# By default, the package command corresponds to a package npm script:
yarn run publish --from-dry-run
# If there is no make script:
yarn electron-forge publish --from-dry-run

{% endtab %}

{% tab title="NPM" %}

# By default, the package command corresponds to a package npm script:
npm run publish -- --from-dry-run
# If there is no make script:
npx electron-forge package --arch=ia32

{% endtab %} {% endtabs %}

Start

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.

FlagValueRequiredDescription
--app-pathPath to your app from CWDNoOverride the path to the Electron app to launch (defaults to .)
--enable-loggingN/ANoEnable advanced logging. This will log internal Electron things
--run-as-nodeN/ANoRun the Electron app as a Node.JS script
--inspect-electronN/ANoTriggers inspect mode on Electron to allow debugging the main process
--extra argumentsNoAny additional arguments to pass to Electron or the app itself. For example: -- --my-app-argument

Example:

{% tabs %} {% tab title="Yarn" %}

yarn start --enable-logging

{% endtab %}

{% tab title="NPM" %}

npm start -- --enable-logging

{% endtab %} {% endtabs %}

7.4.0

22 days ago

7.3.1

1 month ago

7.3.0

2 months ago

6.3.0

9 months ago

7.1.0

6 months ago

6.4.2

8 months ago

6.4.1

9 months ago

6.4.0

9 months ago

7.0.0

6 months ago

7.2.0

5 months ago

6.1.0

1 year ago

6.1.1

1 year ago

6.2.1

11 months ago

6.2.0

11 months ago

6.0.5

1 year ago

6.0.0-beta.69

2 years ago

6.0.0-beta.68

2 years ago

6.0.0-beta.67

2 years ago

6.0.0-beta.66

2 years ago

6.0.1

1 year ago

6.0.0

2 years ago

6.0.3

1 year ago

6.0.2

1 year ago

6.0.4

1 year ago

6.0.0-beta.73

2 years ago

6.0.0-beta.72

2 years ago

6.0.0-beta.71

2 years ago

6.0.0-beta.70

2 years ago

6.0.0-beta.75

2 years ago

6.0.0-beta.74

2 years ago

6.0.0-beta.65

2 years ago

6.0.0-beta.64

2 years ago

6.0.0-beta.62

2 years ago

6.0.0-beta.63

2 years ago

6.0.0-beta.61

3 years ago

6.0.0-beta.60

3 years ago

6.0.0-beta.59

3 years ago

6.0.0-beta.58

3 years ago

6.0.0-beta.57

3 years ago

6.0.0-beta.56

3 years ago

6.0.0-beta.55

3 years ago

6.0.0-beta.54

4 years ago

6.0.0-beta.53

4 years ago

6.0.0-beta.52

4 years ago

6.0.0-beta.51

4 years ago

6.0.0-beta.50

4 years ago

6.0.0-beta.49

4 years ago

6.0.0-beta.48

4 years ago

6.0.0-beta.47

4 years ago

6.0.0-beta.46

4 years ago

6.0.0-beta.45

5 years ago

6.0.0-beta.44

5 years ago

6.0.0-beta.43

5 years ago

6.0.0-beta.42

5 years ago

6.0.0-beta.41

5 years ago

6.0.0-beta.40

5 years ago

6.0.0-beta.39

5 years ago

6.0.0-beta.38

5 years ago

6.0.0-beta.37

5 years ago

6.0.0-beta.36

5 years ago

6.0.0-beta.35

5 years ago

6.0.0-beta.34

5 years ago

6.0.0-beta.33

5 years ago

6.0.0-beta.32

5 years ago

6.0.0-beta.31

5 years ago

6.0.0-beta.30

5 years ago

6.0.0-beta.29

6 years ago

6.0.0-beta.28

6 years ago

6.0.0-beta.27

6 years ago

6.0.0-beta.26

6 years ago

6.0.0-beta.25

6 years ago

6.0.0-beta.24

6 years ago

6.0.0-beta.23

6 years ago

6.0.0-beta.22

6 years ago

6.0.0-beta.21

6 years ago

6.0.0-beta.20

6 years ago

6.0.0-beta.19

6 years ago

6.0.0-beta.18

6 years ago

6.0.0-beta.17

6 years ago

6.0.0-beta.16

6 years ago

6.0.0-beta.15

6 years ago

6.0.0-beta.14

6 years ago

6.0.0-beta.13

6 years ago

6.0.0-beta.12

6 years ago

6.0.0-beta.11

6 years ago

6.0.0-beta.10

6 years ago

6.0.0-beta.9

6 years ago

6.0.0-beta.8

6 years ago

6.0.0-beta.7

6 years ago

6.0.0-beta.6

6 years ago

6.0.0-beta.5

6 years ago

6.0.0-beta.4

6 years ago

6.0.0-beta.3

6 years ago

6.0.0-beta.2

6 years ago

6.0.0-beta.1

6 years ago