Skip to content
Permalink
Browse files

feat(core): V6 API (#433)

* temp

* Start working in new package structure

* Example maker

* All makers implemented and tests passing on darwin

* Add v6 branches to travis config

* Add v6 branches to appveyor config

* Gitignore _old

* Remove FIXME comments

* Remove from CI branch whitelist

* Install bolt on docker

* Add to whitelist

* Fix bolt usage on CI

* Run bolt build on CI

* Fix tests on CI

* Fix linting

* Fix CI

* Make publishers work and add specs

* Docs template

* Initial docs

* update plugin interface to support resolving strings

* more docs

* add deps and scripts

* send makeResults instead of flatten artifacts list

* feat(publisher): Allow to configure channel for ERS (#456)

* fix(publisher): call resolve() when electron-release-server publisher succeeds (#465)

ISSUES CLOSED: #460

* Fix publisher tests

* Remove stray console statement

* v6-api is a PR now, no need to explicitly add to CI

* Add top level license

* Change Maker/Publisher syntax so that they can be constructed with a config variable

* Fix custom init

* Allow absolute paths to custom modules
* Update to new @electron-forge/ scope

* Add missing semi

* Use absolute path for custom init to avoid runnig npm link on windows

* Fix appx test reference to fixture key file

* Remove shell completion support (#447)

tabtab is rather buggy and the alternative, commander-completion, needs
a custom completion script to be written and maintained.

* install new beta tagged bolt on CI

* Fix testing snap building in Travis

* fix remove error

* Fix config passing in tests

* fix search order
  • Loading branch information
MarshallOfSound committed Apr 11, 2018
1 parent d59695e commit 364ba8d8eee91fbb6cbc2e439ff2a6827639494f
Showing with 11,661 additions and 1,966 deletions.
  1. +7 −2 .appveyor.yml
  2. +17 −0 .babelrc
  3. +6 −1 .eslintrc
  4. 0 { → .github}/issue_template.md
  5. 0 { → .github}/pull_request_template.md
  6. +3 −5 .gitignore
  7. +1 −0 .nvmrc
  8. +2 −3 .travis.yml
  9. +7 −2 ci/docker.sh
  10. +4 −1 ci/script.sh
  11. +2 −0 docs/.gitignore
  12. +1 −0 docs/README.md
  13. +38 −0 docs/SUMMARY.md
  14. +11 −0 docs/book.json
  15. +118 −0 docs/cli.md
  16. +204 −0 docs/extend.md
  17. +53 −0 docs/plugins.md
  18. +11 −0 docs/styles/website.css
  19. +0 −40 gulpfile.babel.js
  20. +2 −0 mocha.opts
  21. +54 −113 package.json
  22. +33 −0 packages/api/cli/package.json
  23. 0 { → packages/api/cli}/script/vscode.cmd
  24. 0 { → packages/api/cli}/script/vscode.sh
  25. +2 −1 { → packages/api/cli}/src/electron-forge-import.js
  26. +2 −1 { → packages/api/cli}/src/electron-forge-init.js
  27. +2 −1 { → packages/api/cli}/src/electron-forge-install.js
  28. +2 −1 { → packages/api/cli}/src/electron-forge-lint.js
  29. +2 −1 { → packages/api/cli}/src/electron-forge-make.js
  30. +2 −1 { → packages/api/cli}/src/electron-forge-package.js
  31. +2 −2 { → packages/api/cli}/src/electron-forge-publish.js
  32. +2 −1 { → packages/api/cli}/src/electron-forge-start.js
  33. +14 −37 { → packages/api/cli}/src/electron-forge.js
  34. +1 −1 { → packages/api/cli}/src/util/check-system.js
  35. 0 { → packages/api/cli}/src/util/terminate.js
  36. +2 −2 test/fast/system_spec.js → packages/api/cli/test/check-system_spec.js
  37. 0 { → packages/api/core}/.esdoc.json
  38. 0 { → packages/api/core}/.eslintignore
  39. +1 −0 packages/api/core/.gitignore
  40. 0 { → packages/api/core}/.npmignore
  41. 0 { → packages/api/core}/CHANGELOG.md
  42. +1 −0 packages/api/core/README.md
  43. +63 −0 packages/api/core/package.json
  44. +27 −19 { → packages/api/core}/src/api/import.js
  45. 0 { → packages/api/core}/src/api/index.js
  46. +20 −6 {src/init → packages/api/core/src/api/init-scripts}/init-custom.js
  47. +3 −8 {src/init → packages/api/core/src/api/init-scripts}/init-directory.js
  48. +1 −2 {src/init → packages/api/core/src/api/init-scripts}/init-git.js
  49. +5 −5 {src/init → packages/api/core/src/api/init-scripts}/init-npm.js
  50. +2 −3 {src/init → packages/api/core/src/api/init-scripts}/init-starter-files.js
  51. +7 −8 { → packages/api/core}/src/api/init.js
  52. +20 −32 { → packages/api/core}/src/api/install.js
  53. +1 −1 { → packages/api/core}/src/api/lint.js
  54. +46 −26 { → packages/api/core}/src/api/make.js
  55. +7 −7 { → packages/api/core}/src/api/package.js
  56. +35 −25 { → packages/api/core}/src/api/publish.js
  57. +1 −1 { → packages/api/core}/src/api/start.js
  58. 0 { → packages/api/core}/src/util/config-fn.js
  59. 0 { → packages/api/core}/src/util/deprecate.js
  60. 0 { → packages/api/core}/src/util/electron-version.js
  61. +7 −27 { → packages/api/core}/src/util/forge-config.js
  62. 0 { → packages/api/core}/src/util/hook.js
  63. +1 −3 { → packages/api/core}/src/util/install-dependencies.js
  64. 0 { → packages/api/core}/src/util/is-installed.js
  65. 0 { → packages/api/core}/src/util/linux-config.js
  66. 0 { → packages/api/core}/src/util/linux-installer.js
  67. 0 { → packages/api/core}/src/util/messages.js
  68. 0 { → packages/api/core}/src/util/out-dir.js
  69. 0 { → packages/api/core}/src/util/parse-archs.js
  70. +16 −3 { → packages/api/core}/src/util/plugin-interface.js
  71. 0 { → packages/api/core}/src/util/publish-state.js
  72. 0 { → packages/api/core}/src/util/read-package-json.js
  73. +1 −2 { → packages/api/core}/src/util/rebuild.js
  74. 0 { → packages/api/core}/src/util/require-search.js
  75. 0 { → packages/api/core}/src/util/resolve-dir.js
  76. 0 { → packages/api/core}/src/util/yarn-or-npm.js
  77. 0 { → packages/api/core}/test/.eslintrc
  78. +13 −30 { → packages/api/core}/test/fast/forge-config_spec.js
  79. 0 { → packages/api/core}/test/fast/hook_spec.js
  80. 0 { → packages/api/core}/test/fast/install-dependencies_spec.js
  81. 0 { → packages/api/core}/test/fast/out-dir_spec.js
  82. 0 { → packages/api/core}/test/fast/parse-archs_spec.js
  83. +80 −27 { → packages/api/core}/test/fast/publish_spec.js
  84. 0 { → packages/api/core}/test/fast/read-package-json_spec.js
  85. 0 { → packages/api/core}/test/fast/require-search_spec.js
  86. 0 { → packages/api/core}/test/fast/resolve-dir_spec.js
  87. +0 −30 { → packages/api/core}/test/fast/start_spec.js
  88. +1 −0 { → packages/api/core}/test/fast/yarn-or-npm_spec.js
  89. BIN { → packages/api/core}/test/fixture/bogus-private-key.pvk
  90. 0 { → packages/api/core}/test/fixture/custom_init/index.js
  91. +5 −0 packages/api/core/test/fixture/custom_init/package-lock.json
  92. 0 { → packages/api/core}/test/fixture/custom_init/package.json
  93. 0 { → packages/api/core}/test/fixture/custom_init/tmpl/_bar
  94. 0 { → packages/api/core}/test/fixture/custom_init/tmpl/src/foo.js
  95. 0 { → packages/api/core}/test/fixture/dummy_app/foo/null
  96. +24 −0 packages/api/core/test/fixture/dummy_app/package.json
  97. +8 −0 packages/api/core/test/fixture/dummy_js_conf/forge.config.js
  98. 0 { → packages/api/core}/test/fixture/dummy_js_conf/package.json
  99. +6 −0 packages/api/core/test/fixture/maker-incompatible.js
  100. +5 −0 packages/api/core/test/fixture/maker-unsupported.js
  101. 0 { → packages/api/core}/test/fixture/native_app/package.json
  102. +61 −50 { → packages/api/core}/test/slow/api_spec_slow.js
  103. 0 { → packages/api/core}/test/slow/install-dependencies_spec_slow.js
  104. +25 −47 { → packages/api/core}/test/slow/install_spec_slow.js
  105. 0 { → packages/api/core}/test/slow/rebuild_spec_slow.js
  106. 0 { → packages/api/core}/tmpl/_appveyor.yml
  107. 0 { → packages/api/core}/tmpl/_gitignore
  108. 0 { → packages/api/core}/tmpl/_travis.yml
  109. 0 { → packages/api/core}/tmpl/index.html
  110. 0 { → packages/api/core}/tmpl/index.js
  111. +46 −0 packages/api/core/tmpl/package.json
  112. +19 −0 packages/installer/base/package.json
  113. +21 −0 packages/installer/base/src/Installer.js
  114. +15 −0 packages/installer/base/test/Installer_spec.js
  115. +24 −0 packages/installer/darwin/package.json
  116. +32 −0 packages/installer/darwin/src/InstallerDarwin.js
  117. +21 −0 packages/installer/deb/package.json
  118. +13 −0 packages/installer/deb/src/InstallerDeb.js
  119. +24 −0 packages/installer/dmg/package.json
  120. +41 −0 packages/installer/dmg/src/InstallerDMG.js
  121. 0 { → packages/installer/dmg}/src/util/hdiutil.js
  122. +22 −0 packages/installer/exe/package.json
  123. +15 −0 packages/installer/exe/src/InstallerExe.js
  124. +23 −0 packages/installer/linux/package.json
  125. +22 −0 packages/installer/linux/src/InstallerLinux.js
  126. +21 −0 packages/installer/rpm/package.json
  127. +13 −0 packages/installer/rpm/src/InstallerRpm.js
  128. +23 −0 packages/installer/zip/package.json
  129. +30 −0 packages/installer/zip/src/InstallerZip.js
  130. +30 −0 packages/maker/appx/package.json
  131. +125 −0 packages/maker/appx/src/MakerAppX.js
  132. 0 { → packages/maker/appx}/src/util/author-name.js
  133. +41 −0 packages/maker/appx/test/MakerAppX_spec.js
  134. +1 −1 {test/fast → packages/maker/appx/test}/author-name_spec.js
  135. +22 −0 packages/maker/base/package.json
  136. +91 −0 packages/maker/base/src/Maker.js
  137. +6 −5 {test/fast → packages/maker/base/test}/ensure-output_spec.js
  138. +25 −0 packages/maker/deb/package.json
  139. +47 −0 packages/maker/deb/src/MakerDeb.js
  140. +93 −0 packages/maker/deb/test/MakerDeb_spec.js
  141. +30 −0 packages/maker/dmg/package.json
  142. +38 −0 packages/maker/dmg/src/MakerDMG.js
  143. +19 −11 test/fast/makers/dmg_spec.js → packages/maker/dmg/test/MakerDMG_spec.js
  144. +27 −0 packages/maker/flatpak/package.json
  145. +47 −0 packages/maker/flatpak/src/MakerFlatpak.js
  146. +18 −14 test/fast/makers/flatpak_spec.js → packages/maker/flatpak/test/MakerFlatpak_spec.js
  147. +29 −0 packages/maker/rpm/package.json
  148. +46 −0 packages/maker/rpm/src/MakerRpm.js
  149. +40 −14 test/fast/makers/rpm_spec.js → packages/maker/rpm/test/MakerRpm_spec.js
  150. +28 −0 packages/maker/snap/package.json
  151. +32 −0 packages/maker/snap/src/MakerSnap.js
  152. +19 −14 test/fast/makers/snap_spec.js → packages/maker/snap/test/MakerSnap_spec.js
  153. +26 −0 packages/maker/squirrel/package.json
  154. +53 −0 packages/maker/squirrel/src/MakerSquirrel.js
  155. +23 −0 packages/maker/wix/package.json
  156. +42 −0 packages/maker/wix/src/MakerWix.js
  157. +19 −0 packages/maker/wix/src/util/author-name.js
  158. +30 −0 packages/maker/wix/test/author-name_spec.js
  159. +25 −0 packages/maker/zip/package.json
  160. +56 −0 packages/maker/zip/src/MakerZIP.js
  161. +19 −0 packages/publisher/base/package.json
  162. +36 −0 packages/publisher/base/src/Publisher.js
  163. +15 −0 packages/publisher/base/test/Publisher_spec.js
  164. +27 −0 packages/publisher/electron-release-server/package.json
  165. +127 −0 packages/publisher/electron-release-server/src/PublisherERS.js
  166. +27 −0 packages/publisher/github/package.json
  167. +85 −0 packages/publisher/github/src/PublisherGithub.js
  168. 0 { → packages/publisher/github}/src/util/github.js
  169. +1 −1 {test/fast → packages/publisher/github/test}/github_spec.js
  170. +25 −0 packages/publisher/s3/package.json
  171. +80 −0 packages/publisher/s3/src/PublisherS3.js
  172. +27 −0 packages/publisher/snapcraft/package.json
  173. +35 −0 packages/publisher/snapcraft/src/PublisherSnapcraft.js
  174. +27 −0 packages/utils/async-ora/package.json
  175. +8 −0 packages/utils/async-ora/src/index.js
  176. 0 {src/util → packages/utils/async-ora/src}/ora-handler.js
  177. +1 −1 {src/util → packages/utils/async-ora/src}/ora.js
  178. +1 −1 {test/fast → packages/utils/async-ora/test}/ora-handler_spec.js
  179. +0 −31 src/installers/darwin/dmg.js
  180. +0 −20 src/installers/darwin/zip.js
  181. +0 −5 src/installers/linux/deb.js
  182. +0 −5 src/installers/linux/rpm.js
  183. +0 −3 src/installers/win32/exe.js
  184. +0 −32 src/makers/darwin/dmg.js
  185. +0 −48 src/makers/generic/zip.js
  186. +0 −38 src/makers/linux/deb.js
  187. +0 −43 src/makers/linux/flatpak.js
  188. +0 −39 src/makers/linux/rpm.js
  189. +0 −22 src/makers/linux/snap.js
  190. +0 −102 src/makers/win32/appx.js
  191. +0 −42 src/makers/win32/squirrel.js
  192. +0 −31 src/makers/win32/wix.js
  193. +0 −114 src/publishers/electron-release-server.js
  194. +0 −72 src/publishers/github.js
  195. +0 −72 src/publishers/s3.js
  196. +0 −28 src/publishers/snapcraft.js
  197. +0 −49 src/util/config.js
  198. +0 −12 src/util/confirm-if-interactive.js
  199. +0 −22 src/util/ensure-output.js
  200. +0 −39 src/util/move-app.js
  201. +0 −21 tabtab-install.js
  202. +0 −31 test/fast/config_spec.js
  203. +0 −36 test/fast/confirm-if-interactive_spec.js
  204. +0 −152 test/fast/electron_forge_start_spec.js
  205. +0 −38 test/fast/makers/appx_spec.js
  206. +0 −64 test/fast/makers/deb_spec.js
  207. +0 −24 test/fast/makers_spec.js
  208. +0 −34 test/fixture/dummy_app/package.json
  209. +0 −13 test/fixture/dummy_js_conf/forge.config.js
  210. +0 −1 test/fixture/maker-incompatible.js
  211. +0 −3 test/fixture/maker-unsupported.js
  212. +0 −2 test/mocha.opts
  213. +0 −38 tmpl/package.json
  214. +8,467 −0 yarn.lock
@@ -10,11 +10,16 @@ cache:
branches:
only:
- master
- v6

install:
- ps: Install-Product node $env:nodejs_version $env:platform
- set PATH=%APPDATA%\npm;%PATH%
- yarn
- npm i -g bolt@0.20.1
- if not exist "node_modules" mkdir node_modules
- ps: Remove-Item node_modules -Recurse -Force
- bolt
- bolt build
- ps: |
$wixToolsetBinPath = ";C:\Program Files (x86)\WiX Toolset v3.11\bin;"
$env:PATH = $env:PATH + $wixToolsetBinPath
@@ -27,6 +32,6 @@ install:
test_script:
- node --version
- yarn --version
- yarn test --installer=%node_installer%
- bolt ws test

build: off
@@ -0,0 +1,17 @@
{
"sourceMaps": "inline",
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread"
],
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "6"
}
}
]
]
}
@@ -4,6 +4,9 @@
"plugins": [
"mocha"
],
"env": {
"mocha": true
},
"rules": {
"consistent-return": 0,
"global-require": 0,
@@ -16,6 +19,8 @@
"mocha/no-exclusive-tests": "error",
"no-console": 0,
"no-throw-literal": 0,
"no-underscore-dangle": 0
"no-underscore-dangle": 0,
"class-methods-use-this": 0,
"no-confusing-arrow": 0
}
}
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,4 @@
dist
node_modules
docs
.nyc_output
coverage
npm-debug.log
dist
yarn-error.log
packages/.old
1 .nvmrc
@@ -0,0 +1 @@
8.9.1
@@ -19,11 +19,10 @@ env:
branches:
only:
- master
- v6
- /^v\d+\.\d+\.\d+/
before_install: if [[ "$NODE_INSTALLER" = "yarn" ]]; then npm install -g yarn@0.23.3; fi
install:
- npm install
- npm update
- npm i -g bolt@0.20.1
script: ci/script.sh
after_success: ci/coverage.sh
notifications:
@@ -2,8 +2,13 @@

NODE_INSTALLER="$1"

if [[ "$NODE_INSTALLER" = "yarn" ]]; then npm i -g yarn; fi
npm i -g yarn
npm i -g bolt@0.20.1

cd /code

CI=true npm run test -- --installer=$NODE_INSTALLER
bolt
bolt build
bolt lint

DEBUG=electron-installer-snap:snapcraft CI=true bolt ws test -- --installer=$NODE_INSTALLER
@@ -3,5 +3,8 @@
if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
sudo docker run --privileged --interactive --tty --volume $(pwd):/code malept/electron-forge-container:latest /code/ci/docker.sh $NODE_INSTALLER
else
npm run test-coverage -- --installer=$NODE_INSTALLER
bolt
bolt build
bolt lint
bolt ws test
fi
@@ -0,0 +1,2 @@
_book
node_modules
@@ -0,0 +1 @@
# Electron Forge
@@ -0,0 +1,38 @@
# Summary

* [Introduction](README.md)
* [Configuration](config.md)
* [CLI](cli.md)
* [Import](cli.md#import)
* [Init](cli.md#init)
* [Install](cli.md#install)
* [Lint](cli.md#lint)
* [Make](cli.md#make)
* [Package](cli.md#package)
* [Publish](cli.md#publish)
* [Start](cli.md#start)
* [API Docs](https://docs.electronforge.io)
* [Plugins](plugins.md)
* [Webpack](plugins.md#webpack)
* [Electron Compile](plugins.md#electron-compile)
* [Parcel](plugins.md#parcel)
* [Makers](makers.md)
* [AppX](makers.md#appx)
* [Deb](makers.md#deb)
* [DMG](makers.md#dmg)
* [Flatpak](makers.md#flatpak)
* [RPM](makers.md#rpm)
* [Snapcraft](makers.md#snap)
* [Squirrel.Windows](makers.md#squirrel)
* [Wix MSI](makers.md#wix)
* [Zip](makers.md#zip)
* Publishers
* [Electron Release Server](publisher/ers.md)
* [GitHub](publisher/github.md)
* [S3](publisher/s3.md)
* [Snapcraft](publisher/snap.md)
* [Extending Electron Forge](extend.md)
* [Writing Plugins](extend.md#writing-plugins)
* [Writing Makers](extend.md#writing-makers)
* [Writing Publishers](extend.md#writing-publishers)

@@ -0,0 +1,11 @@
{
"plugins": ["theme-api", "panel", "collapsible-menu", "ace"],
"pluginsConfig": {
"theme-api": {
"theme": "dark"
}
},
"styles": {
"website": "styles/website.css"
}
}
@@ -0,0 +1,118 @@
# Electron Forge CLI

{% method %}
## Installation

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.

{% sample lang="sh" %}
```sh
# NPM
npm i -g @electron-forge/cli
# Yarn
yarn global add @electron-forge/cli
```

{% endmethod %}

## Overview

At a high level the CLI module is just a proxy to the raw
[API](https://docs.electronforge.io) commands. Almost all the configuation
is still done in your [Forge Config](config), the CLI just provides a handy
way to trigger all the core functionality of Electron Forge (and you should
definitely use it).

## Commands

Please note these commands are sorted in alphabetical order, the ones you
probably need to care about are [`start`](#start), [`package`](#package),
[`make`](#make) and [`publish`](#publish).

### Import

Maps to `electronForge.import`, will attempt to take an existing Electron app
and make it Forge compatible. Normally this is just created a base forge config
and adding 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 `.`).

Please note if you want to use a template it must be installed globally before
running the `init` command.

| Flag | Value | Description |
|------|-------|-------------|
| `--template` | Template Name | Name of the template to use to make this new app|
| `--copy-ci-files` | N/A | Set if you want to copy templated CI files for Travis CI and Appveyor |

### 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.

### 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.

| Flag | Value | Description |
|------|-------|-------------|
| `--arch` | Architecture E.g. `x64` | Target architecture to make for |
| `--platform` | Platform E.g. `mas` | Target platform to make for, please note you normally can only target platform X from platform X |
| `--targets` | Comma separated list of maker names | Override your make targets for this run |
| `--skip-package` | N/A | Set if you want to skip the packaging step, useful if you are running sequential makes and want to save time |

### 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`](#make) command.

| Flag | Value | Description |
|------|-------|-------------|
| `--arch` | Architecture E.g. `x64` | Target architecture to package for |
| `--platform` | Platform E.g. `mas` | Target platform to package for |

### 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.

| Flag | Value | Description |
|------|-------|-------------|
| `--tag` | Version | The version to publish these artifacts as |
| `--target` | Comma separated list of publisher names | Override your publish targets for this run |
| `--dry-run` | N/A | Triggers a publish dry run which saves state and doesn't upload anything |
| `--from-dry-run` | N/A | Attempts to publish artifacts from any dry runs saved on disk |

### Start

Maps to `electronForge.start`, will launch the Forge powered application in the
given directory (defaults to `.`).

| Flag | Value | Description |
|------|-------|-------------|
| `--app-path` | Path to your app from CWD | Override the path to the Electron app to launch (defaults to '.') |
| `--enable-logging` | N/A | Enable advanced logging. This will log internal Electron things |
| `--run-as-node` | N/A | Run the Electron app as a Node.JS script |
| `--inspect-electron` | N/A | Triggers inspect mode on Electron to allow debugging the main process |

0 comments on commit 364ba8d

Please sign in to comment.
You can’t perform that action at this time.