Skip to main content

Interface: Hooks

Extended by

Properties

afterAllArtifactBuild?

readonly optional afterAllArtifactBuild?: string | Hook<BuildResult, string[]> | null

The function (or path to file or module id) to be run after all artifacts are built. Receives a BuildResult. May return an array of additional file paths to publish.

For file/module setup, see beforePack.

Example

exports.default = function () {
// return additional files to publish
return ["/path/to/additional/result/file"]
}

afterExtract?

readonly optional afterExtract?: string | Hook<PackContext, void> | null

The function (or path to file or module id) to be run after the prebuilt Electron binary has been extracted to the output directory. Receives an AfterExtractContext. For file/module setup, see beforePack.


afterPack?

readonly optional afterPack?: string | Hook<PackContext, void> | null

The function (or path to file or module id) to be run after pack but before pack into distributable format and sign. Receives an AfterPackContext. For file/module setup, see beforePack.


afterSign?

readonly optional afterSign?: string | Hook<PackContext, void> | null

The function (or path to file or module id) to be run after pack and sign but before pack into distributable format. Receives an AfterPackContext. For file/module setup, see beforePack.


appxManifestCreated?

readonly optional appxManifestCreated?: string | Hook<string, void> | null

The function (or path to file or module id) to be run after Appx manifest created on disk - not packed into .appx package yet.


artifactBuildCompleted?

readonly optional artifactBuildCompleted?: string | Hook<ArtifactCreated, void> | null

The function (or path to file or module id) to be run when an individual artifact build completes. Receives an ArtifactCreated. For file/module setup, see beforePack.


artifactBuildStarted?

readonly optional artifactBuildStarted?: string | Hook<ArtifactBuildStarted, void> | null

The function (or path to file or module id) to be run when an individual artifact build starts. Receives an ArtifactBuildStarted. For file/module setup, see beforePack.


beforeBuild?

readonly optional beforeBuild?: string | Hook<BeforeBuildContext, boolean | void> | null

The function (or path to file or module id) to be run before dependencies are installed or rebuilt. Works when npmRebuild is set to true. Resolving to false will skip dependencies install or rebuild.

If provided and node_modules are missing, it will not invoke production dependencies check.


beforePack?

readonly optional beforePack?: string | Hook<PackContext, void> | null

The function (or path to file or module id) to be run before pack. Receives a BeforePackContext.

Can be specified inline as a function in JavaScript configs:

// electron-builder.config.js
module.exports = {
beforePack: async (context) => {
// your code
}
}

Or as a path to a module that exports the function as its default export:

{ "build": { "beforePack": "./myBeforePackHook.js" } }
// myBeforePackHook.js
exports.default = async function(context) {
// your custom code
}

electronDist?

readonly optional electronDist?: string | Hook<PrepareApplicationStageDirectoryOptions, string> | null

The function (or path to file or module id) to be run when staging the electron artifact environment. Returns the path to custom Electron build (e.g. ~/electron/out/R) or folder of electron zips.

Zip files must follow the pattern electron-v${version}-${platformName}-${arch}.zip, otherwise it will be assumed to be an unpacked Electron app directory


msiProjectCreated?

readonly optional msiProjectCreated?: string | Hook<string, void> | null

The function (or path to file or module id) to be run after MSI project created on disk - not packed into .msi package yet.


onNodeModuleFile?

readonly optional onNodeModuleFile?: string | Hook<string, boolean | void> | null

The function (or path to file or module id) to be run on each node module file. Returning true/false will determine whether to force include or to use the default copier logic