UNPKG

4.84 kBMarkdownView Raw
1# CLI
2
3## Installation
4
5Electron forge's CLI is separate from the core module, to install it you will have to use the `@electron-forge/cli` module from NPM.
6
7```bash
8# NPM
9npm i -g @electron-forge/cli
10
11# Yarn
12yarn global add @electron-forge/cli
13```
14
15## Overview
16
17At a high level the CLI module is just a proxy to the raw [API](https://js.electronforge.io) 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\).
18
19## Commands
20
21Please note these commands are sorted in alphabetical order, the ones you probably need to care about are [start](cli.md#start), [package](cli.md#package), [make](cli.md#make), and [publish](cli.md#publish).
22
23### Import
24
25Maps to `electronForge.import`, will attempt to take an existing Electron app and make it Forge compatible. Normally this just creates a base Electron Forge config and adds the required dependencies.
26
27> There are no flags for the Import command
28
29### Init
30
31Maps to `electronForge.init`, will initialize a new Forge powered application in the given directory \(defaults to `.`\).
32
33Please note if you want to use a template, it must be installed globally before running the `init` command.
34
35| Flag | Value | Required | Description |
36| :--- | :--- | :--- | :--- |
37| `--template` | Template Name | No | Name of the template to use to make this new app |
38| `--copy-ci-files` | N/A | No | Set if you want to copy templated CI files for Travis CI and Appveyor |
39
40### Install
41
42Maps 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.
43
44```bash
45electron-forge install atom/atom
46```
47
48### Lint
49
50Maps 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.
51
52> There are no flags for the Lint command
53
54### Make
55
56Maps to `electronForge.make`, will make distributables for your application based on your forge config and the parameters you pass in.
57
58| Flag | Value | Required | Description |
59| :--- | :--- | :--- | :--- |
60| `--arch` | Architecture E.g. `x64` | No | Target architecture to make for |
61| `--platform` | Platform E.g. `mas` | No | Target platform to make for, please note you normally can only target platform X from platform X |
62| `--targets` | Comma separated list of maker names | No | Override your make targets for this run |
63| `--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 |
64
65### Package
66
67Maps 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](cli.md#make) command.
68
69| Flag | Value | Required | Description |
70| :--- | :--- | :--- | :--- |
71| `--arch` | Architecture E.g. `x64` | No | Target architecture to package for. Defaults to the host arch. |
72| `--platform` | Platform E.g. `mas` | No | Target platform to package for. Defaults to the host platform. |
73
74### Publish
75
76Maps to `electronForge.publish`, will attempt to make the forge application and then publish it to the publish targets defined in your forge config.
77
78If you want to publish previously created `make` artifacts you will have to use the `dry-run` options explained below.
79
80| Flag | Value | Required | Description |
81| :--- | :--- | :--- | :--- |
82| `--target` | Comma separated list of publisher names | No | Override your publish targets for this run |
83| `--dry-run` | N/A | No | Triggers a publish dry run which saves state and doesn't upload anything |
84| `--from-dry-run` | N/A | No | Attempts to publish artifacts from any dry runs saved on disk |
85
86### Start
87
88Maps to `electronForge.start`, will launch the Forge powered application in the given directory \(defaults to `.`\).
89
90If you type `rs` \(and hit enter\) in the same terminal where you ran the start command, the running app will be terminated and restarted.
91
92| Flag | Value | Required | Description |
93| :--- | :--- | :--- | :--- |
94| `--app-path` | Path to your app from CWD | No | Override the path to the Electron app to launch \(defaults to `.`\) |
95| `--enable-logging` | N/A | No | Enable advanced logging. This will log internal Electron things |
96| `--run-as-node` | N/A | No | Run the Electron app as a Node.JS script |
97| `--inspect-electron` | N/A | No | Triggers inspect mode on Electron to allow debugging the main process |
98| `--` | extra arguments | No | Any additional arguments to pass to Electron or the app itself. For example: `-- --my-app-argument` |
99