Options to configure packaging.
A Promise containing the paths to the newly created application bundles.
A function that is called on the completion of a packaging stage.
By default, the functions are called in parallel (via
Promise.all
).
If you need the functions called serially, there is a utility function provided. Please note that
callback-style functions are not supported by serialHooks
. For example:
const packager = require('electron-packager')
const { serialHooks } = require('electron-packager/src/hooks')
packager({
// ...
afterCopy: [serialHooks([
(buildPath, electronVersion, platform, arch) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log('first function')
resolve()
}, 1000)
})
},
(buildPath, electronVersion, platform, arch) => {
console.log('second function')
}
])],
// ...
})
For real-world examples of HookFunction
s, see the list of related
plugins.
For afterExtract, the path to the temporary folder where the prebuilt Electron binary has been extracted to. For afterCopy and afterPrune, the path to the folder where the Electron app has been copied to.
the version of Electron that is being bundled with the application.
The target platform you are packaging for.
The target architecture you are packaging for.
Must be called once you have completed your actions.
Must be called once you have completed your actions.
A predicate function that, given an absolute file path
, returns true
if the file should be
ignored, or false
if the file should be kept. This does not use any of the default ignored
files/directories listed for the ignore option.
Architectures that have been supported by the official Electron prebuilt binaries, past and present.
Platforms that have been supported by the official Electron prebuilt binaries, past and present.
See the documentation for electron-notarize
for details.
See the documentation for electron-osx-sign
for details.
Generated using TypeDoc
Bundles Electron-based application source code with a renamed/customized Electron executable and its supporting files into folders ready for distribution.
Briefly, this function:
<out>/<appname>-<platform>-<arch>
Short example:
const packager = require('electron-packager') async function bundleElectronApp(options) { const appPaths = await packager(options) console.log(`Electron app bundles created:\n${appPaths.join("\n")}`) }