Build Hooks
Hooks¶
Node.js 8
All examples assumed that you use latest Node.js 8.11.x or higher.
Electron-Builder / app-builder-lib / Hooks
Extended by¶
Properties¶
afterAllArtifactBuild?¶
readonlyoptionalafterAllArtifactBuild:null|string|Hook<BuildResult,string[]>
The function (or path to file or module id) to be run after all artifacts are built.
(buildResult: BuildResult): Promise<Array<string>> | Array<string>
Configuration in the same way as afterPack (see above).
myAfterAllArtifactBuild.js
exports.default = function () {
// you can return additional files to publish
return ["/path/to/additional/result/file"]
}
afterExtract?¶
readonlyoptionalafterExtract:null|string|Hook<PackContext,any>
The function (or path to file or module id) to be run after the prebuilt Electron binary has been extracted to the output directory
afterPack?¶
readonlyoptionalafterPack:null|string|Hook<PackContext,any>
The function (or path to file or module id) to be run after pack (but before pack into distributable format and sign).
afterSign?¶
readonlyoptionalafterSign:null|string|Hook<PackContext,any>
The function (or path to file or module id) to be run after pack and sign (but before pack into distributable format).
appxManifestCreated?¶
readonlyoptionalappxManifestCreated:null|string|Hook<string,any>
Appx manifest created on disk - not packed into .appx package yet.
artifactBuildCompleted?¶
readonlyoptionalartifactBuildCompleted:null|string|Hook<ArtifactCreated,any>
The function (or path to file or module id) to be run on artifact build completed.
artifactBuildStarted?¶
readonlyoptionalartifactBuildStarted:null|string|Hook<ArtifactBuildStarted,any>
The function (or path to file or module id) to be run on artifact build start.
beforeBuild?¶
readonlyoptionalbeforeBuild:null|string|Hook<BeforeBuildContext,boolean|void>
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?¶
readonlyoptionalbeforePack:null|string|Hook<PackContext,any>
The function (or path to file or module id) to be run before pack.
(context: BeforePackContext): Promise<any> | any
As function
beforePack: async (context) => {
// your code
}
Because in a configuration file you cannot use JavaScript, can be specified as a path to file or module id. Function must be exported as default export.
"build": {
"beforePack": "./myBeforePackHook.js"
}
File myBeforePackHook.js in the project root directory:
myBeforePackHook.js
exports.default = async function(context) {
// your custom code
}
msiProjectCreated?¶
readonlyoptionalmsiProjectCreated:null|string|Hook<string,any>
MSI project created on disk - not packed into .msi package yet.
onNodeModuleFile?¶
readonlyoptionalonNodeModuleFile:null|string|Hook<string,boolean|void>
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