package.jsonis by far the more simpler approach, but for advanced options, such as providing hook functions to Electron Forge, you will need to use the JS file.
startlaunches the application and before
packageis run, you should use this hook to generate any static files or resources your app requires but aren't in source code. For instance you could use this hook to generate a license file containing the license of all your dependencies.
startlaunches the application, you should use this hook to attach listeners to the spawned child process. The spawned process is passed through as the second hook argument.
packagestep has successfully completed. The hook is passed the following parameters inside of an
platform: the target platform for the app
arch: the target architecture for the app
outputPaths: an array of paths where packaged apps are located (usually only one)
spinner: if defined, the
oraspinner associated with the package step
package.jsonfile, you will be passed in the
package.jsonobject we have loaded and if you want to modify that object in any way you must do so and return the new value for Forge to use. This is useful to set things like the
versionfield at runtime.
beta. This identifier can be used in conjunction with the
fromBuildIdentifierfunction to generate release channel or environment specific configuration. For example:
appBundleIdoption passed to Electron Packager will be selected based on the
buildIdentiferbased on whether you are building for
beta. This allows you to make shared configs incredibly easily as only the values that change need to be wrapped with this function.