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?¶
readonly
optional
afterAllArtifactBuild: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?¶
readonly
optional
afterExtract: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?¶
readonly
optional
afterPack: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?¶
readonly
optional
afterSign: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?¶
readonly
optional
appxManifestCreated:null
|string
|Hook
<string
,any
>
Appx manifest created on disk - not packed into .appx package yet.
artifactBuildCompleted?¶
readonly
optional
artifactBuildCompleted:null
|string
|Hook
<ArtifactCreated
,any
>
The function (or path to file or module id) to be run on artifact build completed.
artifactBuildStarted?¶
readonly
optional
artifactBuildStarted:null
|string
|Hook
<ArtifactBuildStarted
,any
>
The function (or path to file or module id) to be run on artifact build start.
beforeBuild?¶
readonly
optional
beforeBuild: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?¶
readonly
optional
beforePack: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?¶
readonly
optional
msiProjectCreated:null
|string
|Hook
<string
,any
>
MSI project created on disk - not packed into .msi package yet.
onNodeModuleFile?¶
readonly
optional
onNodeModuleFile: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