Common Configuration
electron-builder configuration can be defined
- in the
package.jsonfile of your project using thebuildkey on the top level:"build": { "appId": "com.example.app" } -
or through the
--config <path/to/yml-or-json5-or-toml-or-js>option. Defaults toelectron-builder.yml.appId: "com.example.app"json, json5, toml orjs/ts(exported configuration or function that produces configuration) formats also supported.Tip
If you want to use
jsfile, do not name itelectron-builder.js. It will conflict withelectron-builderpackage name.Tip
If you want to use toml, please install
yarn add toml --dev.
Most of the options accept null — for example, to explicitly set that DMG icon must be default volume icon from the OS and default rules must be not applied (i.e. use application icon as DMG icon), set dmg.icon to null.
Artifact File Name Template¶
${ext} macro is supported in addition to file macros.
Environment Variables from File¶
Env file electron-builder.env in the current dir (example). Supported only for CLI usage.
How to Read Docs¶
- Name of optional property is normal, required is bold.
- Type is specified after property name:
Array<String> | String. Union like this means that you can specify or string (**/*), or array of strings (["**/*", "!foo.js"]).
Configuration¶
Electron-Builder / app-builder-lib / Configuration
Configuration Options
Extends¶
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"]
}
Inherited from¶
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 Same setup as beforePack
Inherited from¶
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). Same setup as beforePack
Inherited from¶
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). Same setup as beforePack
Inherited from¶
apk?¶
readonlyoptionalapk:null|LinuxTargetSpecificOptions
appId?¶
readonlyoptionalappId:null|string
The application id. Used as CFBundleIdentifier for MacOS and as Application User Model ID for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.
Default¶
com.electron.${name}
Overrides¶
PlatformSpecificBuildOptions.appId
appImage?¶
readonlyoptionalappImage:null|AppImageOptions
AppImage options.
appx?¶
readonlyoptionalappx:null|AppXOptions
appxManifestCreated?¶
readonlyoptionalappxManifestCreated:null|string|Hook<string,any>
Appx manifest created on disk - not packed into .appx package yet.
Inherited from¶
artifactBuildCompleted?¶
readonlyoptionalartifactBuildCompleted:null|string|Hook<ArtifactCreated,any>
The function (or path to file or module id) to be run on artifact build completed. Same setup as beforePack
Inherited from¶
artifactBuildStarted?¶
readonlyoptionalartifactBuildStarted:null|string|Hook<ArtifactBuildStarted,any>
The function (or path to file or module id) to be run on artifact build start. Same setup as beforePack
Inherited from¶
artifactName?¶
readonlyoptionalartifactName:null|string
The artifact file name template. Defaults to ${productName}-${version}.${ext} (some target can have other defaults, see corresponding options).
Inherited from¶
PlatformSpecificBuildOptions.artifactName
asar?¶
readonlyoptionalasar:null|boolean|AsarOptions
Whether to package the application’s source code into an archive, using Electron’s archive format.
Node modules, that must be unpacked, will be detected automatically, you don’t need to explicitly set asarUnpack - please file an issue if this doesn’t work.
Default¶
true
Inherited from¶
PlatformSpecificBuildOptions.asar
asarUnpack?¶
readonlyoptionalasarUnpack:null|string|string[]
A glob patterns relative to the app directory, which specifies which files to unpack when creating the asar archive.
Inherited from¶
PlatformSpecificBuildOptions.asarUnpack
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.
Inherited from¶
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
}
Inherited from¶
buildDependenciesFromSource?¶
optionalbuildDependenciesFromSource:boolean
Whether to build the application native dependencies from source.
Default¶
false
buildNumber?¶
readonlyoptionalbuildNumber:null|string
The build number. Maps to the --iteration flag for builds using FPM on Linux.
If not defined, then it will fallback to BUILD_NUMBER or TRAVIS_BUILD_NUMBER or APPVEYOR_BUILD_NUMBER or CIRCLE_BUILD_NUM or BUILD_BUILDNUMBER or CI_PIPELINE_IID env.
buildVersion?¶
readonlyoptionalbuildVersion:null|string
The build version. Maps to the CFBundleVersion on macOS, and FileVersion metadata property on Windows. Defaults to the version.
If buildVersion is not defined and buildNumber (or one of the buildNumber envs) is defined, it will be used as a build version (version.buildNumber).
compression?¶
readonlyoptionalcompression:null|CompressionLevel
The compression level. If you want to rapidly test build, store can reduce build time significantly. maximum doesn’t lead to noticeable size difference, but increase build time.
Default¶
normal
Inherited from¶
PlatformSpecificBuildOptions.compression
copyright?¶
readonlyoptionalcopyright:null|string
The human-readable copyright line for the app.
Default¶
Copyright © year ${author}
cscKeyPassword?¶
optionalcscKeyPassword:null|string
Inherited from¶
PlatformSpecificBuildOptions.cscKeyPassword
cscLink?¶
optionalcscLink:null|string
Inherited from¶
PlatformSpecificBuildOptions.cscLink
deb?¶
readonlyoptionaldeb:null|DebOptions
Debian package options.
defaultArch?¶
readonlyoptionaldefaultArch:string
Inherited from¶
PlatformSpecificBuildOptions.defaultArch
detectUpdateChannel?¶
readonlyoptionaldetectUpdateChannel:boolean
Whether to infer update channel from application version pre-release components. e.g. if version 0.12.1-alpha.1, channel will be set to alpha. Otherwise to latest.
Default¶
true
Inherited from¶
PlatformSpecificBuildOptions.detectUpdateChannel
directories?¶
readonlyoptionaldirectories:null|MetadataDirectories
Directories for build resources
disableDefaultIgnoredFiles?¶
optionaldisableDefaultIgnoredFiles:null|boolean
Whether to exclude all default ignored files(https://www.electron.build/contents#files) and options. Defaults to false.
Default¶
false
Inherited from¶
PlatformSpecificBuildOptions.disableDefaultIgnoredFiles
disableSanityCheckAsar?¶
readonlyoptionaldisableSanityCheckAsar:boolean
Whether to disable sanity check asar package (useful for custom electron forks that implement their own encrypted integrity validation)
Default¶
false
dmg?¶
readonlyoptionaldmg:null|DmgOptions
macOS DMG options.
downloadAlternateFFmpeg?¶
readonlyoptionaldownloadAlternateFFmpeg:boolean
Whether to download the alternate FFmpeg library from Electron’s release assets and replace the default FFmpeg library prior to signing
electronBranding?¶
readonlyoptionalelectronBranding:ElectronBrandingOptions
The branding used by Electron’s distributables. This is needed if a fork has modified Electron’s BRANDING.json file.
electronCompile?¶
readonlyoptionalelectronCompile:boolean
Whether to use electron-compile to compile app. Defaults to true if electron-compile in the dependencies. And false if in the devDependencies or doesn’t specified.
electronDist?¶
readonlyoptionalelectronDist:string|CustomElectronDistributable
Returns the path to custom Electron build (e.g. ~/electron/out/R). Zip files must follow the pattern electron-v${version}-${platformName}-${arch}.zip, otherwise it will be assumed to be an unpacked Electron app directory
electronDownload?¶
readonlyoptionalelectronDownload:ElectronDownloadOptions
The electron-download options.
electronLanguages?¶
readonlyoptionalelectronLanguages:string|string[]
The electron locales to keep. By default, all Electron locales used as-is.
Inherited from¶
PlatformSpecificBuildOptions.electronLanguages
electronUpdaterCompatibility?¶
readonlyoptionalelectronUpdaterCompatibility:null|string
The electron-updater compatibility semver range.
Inherited from¶
PlatformSpecificBuildOptions.electronUpdaterCompatibility
electronVersion?¶
optionalelectronVersion:null|string
The version of electron you are packaging for. Defaults to version of electron, electron-prebuilt or electron-prebuilt-compile dependency.
executableName?¶
readonlyoptionalexecutableName:null|string
The executable name. Defaults to productName.
Inherited from¶
PlatformSpecificBuildOptions.executableName
extends?¶
optionalextends:null|string|string[]
The name of a built-in configuration preset (currently, only react-cra is supported) or any number of paths to config files (relative to project dir).
The latter allows to mixin a config from multiple other configs, as if you Object.assign them, but properly combine files glob patterns.
If react-scripts in the app dependencies, react-cra will be set automatically. Set to null to disable automatic detection.
extraFiles?¶
optionalextraFiles:null|string|FileSet| (string|FileSet)[]
The same as extraResources but copy into the app’s content directory (Contents for MacOS, root directory for Linux and Windows).
Inherited from¶
PlatformSpecificBuildOptions.extraFiles
extraMetadata?¶
readonlyoptionalextraMetadata:any
Inject properties to package.json.
extraResources?¶
optionalextraResources:null|string|FileSet| (string|FileSet)[]
A glob patterns relative to the project directory, when specified, copy the file or directory with matching names directly into the app’s resources directory (Contents/Resources for MacOS, resources for Linux and Windows).
File patterns (and support for from and to fields) the same as for files.
Inherited from¶
PlatformSpecificBuildOptions.extraResources
fileAssociations?¶
readonlyoptionalfileAssociations:FileAssociation|FileAssociation[]
The file associations.
Inherited from¶
PlatformSpecificBuildOptions.fileAssociations
files?¶
optionalfiles:null|string|FileSet| (string|FileSet)[]
A glob patterns relative to the app directory, which specifies which files to include when copying files to create the package.
Defaults to:
[
"**/*",
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}",
"!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}",
"!**/node_modules/*.d.ts",
"!**/node_modules/.bin",
"!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}",
"!.editorconfig",
"!**/._*",
"!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}",
"!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}",
"!**/{appveyor.yml,.travis.yml,circle.yml}",
"!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}"
]
Development dependencies are never copied in any case. You don’t need to ignore it explicitly. Hidden files are not ignored by default, but all files that should be ignored, are ignored by default.
Default pattern **/* is not added to your custom if some of your patterns is not ignore (i.e. not starts with !). package.json and **/node_modules/**/* (only production dependencies will be copied) is added to your custom in any case. All default ignores are added in any case — you don’t need to repeat it if you configure own patterns.
May be specified in the platform options (e.g. in the mac).
You may also specify custom source and destination directories by using FileSet objects instead of simple glob patterns.
[
{
"from": "path/to/source",
"to": "path/to/destination",
"filter": ["**/*", "!foo/*.js"]
}
]
You can use file macros in the from and to fields as well. from and to can be files and you can use this to rename a file while packaging.
Inherited from¶
PlatformSpecificBuildOptions.files
flatpak?¶
readonlyoptionalflatpak:null|FlatpakOptions
Flatpak options.
forceCodeSigning?¶
readonlyoptionalforceCodeSigning:boolean
Whether to fail if the application is not signed (to prevent unsigned app if code signing configuration is not correct).
Default¶
false
Overrides¶
PlatformSpecificBuildOptions.forceCodeSigning
framework?¶
readonlyoptionalframework:null|string
The framework name. One of electron, proton, libui. Defaults to electron.
freebsd?¶
readonlyoptionalfreebsd:null|LinuxTargetSpecificOptions
generateUpdatesFilesForAllChannels?¶
readonlyoptionalgenerateUpdatesFilesForAllChannels:boolean
Please see Building and Releasing using Channels.
Default¶
false
Inherited from¶
PlatformSpecificBuildOptions.generateUpdatesFilesForAllChannels
icon?¶
readonlyoptionalicon:null|string
Inherited from¶
PlatformSpecificBuildOptions.icon
includePdb?¶
readonlyoptionalincludePdb:boolean
Whether to include PDB files.
Default¶
false
includeSubNodeModules?¶
optionalincludeSubNodeModules:boolean
Whether to include all of the submodules node_modules directories
Default¶
false
launchUiVersion?¶
readonlyoptionallaunchUiVersion:null|string|boolean
libui-based frameworks only The version of LaunchUI you are packaging for. Applicable for Windows only. Defaults to version suitable for used framework version.
linux?¶
readonlyoptionallinux:null|LinuxConfiguration
Options related to how build Linux targets.
mac?¶
readonlyoptionalmac:null|MacConfiguration
Options related to how build macOS targets.
mas?¶
readonlyoptionalmas:null|MasConfiguration
MAS (Mac Application Store) options.
masDev?¶
readonlyoptionalmasDev:null|MasConfiguration
MAS (Mac Application Store) development options (mas-dev target).
msiProjectCreated?¶
readonlyoptionalmsiProjectCreated:null|string|Hook<string,any>
MSI project created on disk - not packed into .msi package yet.
Inherited from¶
nativeRebuilder?¶
readonlyoptionalnativeRebuilder:null|"legacy"|"sequential"|"parallel"
Use legacy app-builder binary for installing native dependencies, or @electron/rebuild in sequential or parallel compilation modes.
Default¶
sequential
nodeGypRebuild?¶
readonlyoptionalnodeGypRebuild:boolean
Whether to execute node-gyp rebuild before starting to package the app.
Don’t use npm (neither .npmrc) for configuring electron headers. Use electron-builder node-gyp-rebuild instead.
Default¶
false
nodeVersion?¶
readonlyoptionalnodeVersion:null|string
libui-based frameworks only The version of NodeJS you are packaging for.
You can set it to current to set the Node.js version that you use to run.
npmArgs?¶
readonlyoptionalnpmArgs:null|string|string[]
Additional command line arguments to use when installing app native deps.
npmRebuild?¶
readonlyoptionalnpmRebuild:boolean
Whether to rebuild native dependencies before starting to package the app.
Default¶
true
nsis?¶
readonlyoptionalnsis:null|NsisOptions
nsisWeb?¶
readonlyoptionalnsisWeb:null|NsisWebOptions
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
Inherited from¶
p5p?¶
readonlyoptionalp5p:null|LinuxTargetSpecificOptions
pacman?¶
readonlyoptionalpacman:null|LinuxTargetSpecificOptions
pkg?¶
readonlyoptionalpkg:null|PkgOptions
macOS PKG options.
portable?¶
readonlyoptionalportable:null|PortableOptions
productName?¶
readonlyoptionalproductName:null|string
As name, but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the name property.
If not specified inside of the build configuration, productName property defined at the top level of package.json is used. If not specified at the top level of package.json, name property is used.
protocols?¶
The URL protocol schemes.
Inherited from¶
PlatformSpecificBuildOptions.protocols
publish?¶
optionalpublish:Publish
Inherited from¶
PlatformSpecificBuildOptions.publish
releaseInfo?¶
readonlyoptionalreleaseInfo:ReleaseInfo
The release info. Intended for command line usage:
-c.releaseInfo.releaseNotes="new features"
Inherited from¶
PlatformSpecificBuildOptions.releaseInfo
removePackageKeywords?¶
readonlyoptionalremovePackageKeywords:boolean
Whether to remove keywords field from package.json files.
Default¶
true
removePackageScripts?¶
readonlyoptionalremovePackageScripts:boolean
Whether to remove scripts field from package.json files.
Default¶
true
rpm?¶
readonlyoptionalrpm:null|LinuxTargetSpecificOptions
snap?¶
readonlyoptionalsnap:null|SnapOptions
Snap options.
squirrelWindows?¶
readonlyoptionalsquirrelWindows:null|SquirrelWindowsOptions
target?¶
readonlyoptionaltarget:null|string|TargetConfiguration| (string|TargetConfiguration)[]
Inherited from¶
PlatformSpecificBuildOptions.target
win?¶
readonlyoptionalwin:null|WindowsConfiguration
Options related to how build Windows targets.
Overridable per Platform Options¶
Following options can be set also per platform (top-level keys mac, linux and win) if need.
Base Configuration¶
Electron-Builder / app-builder-lib / PlatformSpecificBuildOptions
Extends¶
Extended by¶
Properties¶
appId?¶
readonlyoptionalappId:null|string
The application id. Used as CFBundleIdentifier for MacOS and as Application User Model ID for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.
Default¶
com.electron.${name}
artifactName?¶
readonlyoptionalartifactName:null|string
The artifact file name template. Defaults to ${productName}-${version}.${ext} (some target can have other defaults, see corresponding options).
Overrides¶
TargetSpecificOptions.artifactName
asar?¶
readonlyoptionalasar:null|boolean|AsarOptions
Whether to package the application’s source code into an archive, using Electron’s archive format.
Node modules, that must be unpacked, will be detected automatically, you don’t need to explicitly set asarUnpack - please file an issue if this doesn’t work.
Default¶
true
asarUnpack?¶
readonlyoptionalasarUnpack:null|string|string[]
A glob patterns relative to the app directory, which specifies which files to unpack when creating the asar archive.
compression?¶
readonlyoptionalcompression:null|CompressionLevel
The compression level. If you want to rapidly test build, store can reduce build time significantly. maximum doesn’t lead to noticeable size difference, but increase build time.
Default¶
normal
cscKeyPassword?¶
optionalcscKeyPassword:null|string
cscLink?¶
optionalcscLink:null|string
defaultArch?¶
readonlyoptionaldefaultArch:string
detectUpdateChannel?¶
readonlyoptionaldetectUpdateChannel:boolean
Whether to infer update channel from application version pre-release components. e.g. if version 0.12.1-alpha.1, channel will be set to alpha. Otherwise to latest.
Default¶
true
disableDefaultIgnoredFiles?¶
optionaldisableDefaultIgnoredFiles:null|boolean
Whether to exclude all default ignored files(https://www.electron.build/contents#files) and options. Defaults to false.
Default¶
false
electronLanguages?¶
readonlyoptionalelectronLanguages:string|string[]
The electron locales to keep. By default, all Electron locales used as-is.
electronUpdaterCompatibility?¶
readonlyoptionalelectronUpdaterCompatibility:null|string
The electron-updater compatibility semver range.
executableName?¶
readonlyoptionalexecutableName:null|string
The executable name. Defaults to productName.
extraFiles?¶
optionalextraFiles:null|string|FileSet| (string|FileSet)[]
The same as extraResources but copy into the app’s content directory (Contents for MacOS, root directory for Linux and Windows).
Inherited from¶
extraResources?¶
optionalextraResources:null|string|FileSet| (string|FileSet)[]
A glob patterns relative to the project directory, when specified, copy the file or directory with matching names directly into the app’s resources directory (Contents/Resources for MacOS, resources for Linux and Windows).
File patterns (and support for from and to fields) the same as for files.
Inherited from¶
FilesBuildOptions.extraResources
fileAssociations?¶
readonlyoptionalfileAssociations:FileAssociation|FileAssociation[]
The file associations.
files?¶
optionalfiles:null|string|FileSet| (string|FileSet)[]
A glob patterns relative to the app directory, which specifies which files to include when copying files to create the package.
Defaults to:
[
"**/*",
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}",
"!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}",
"!**/node_modules/*.d.ts",
"!**/node_modules/.bin",
"!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}",
"!.editorconfig",
"!**/._*",
"!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}",
"!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}",
"!**/{appveyor.yml,.travis.yml,circle.yml}",
"!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}"
]
Development dependencies are never copied in any case. You don’t need to ignore it explicitly. Hidden files are not ignored by default, but all files that should be ignored, are ignored by default.
Default pattern **/* is not added to your custom if some of your patterns is not ignore (i.e. not starts with !). package.json and **/node_modules/**/* (only production dependencies will be copied) is added to your custom in any case. All default ignores are added in any case — you don’t need to repeat it if you configure own patterns.
May be specified in the platform options (e.g. in the mac).
You may also specify custom source and destination directories by using FileSet objects instead of simple glob patterns.
[
{
"from": "path/to/source",
"to": "path/to/destination",
"filter": ["**/*", "!foo/*.js"]
}
]
You can use file macros in the from and to fields as well. from and to can be files and you can use this to rename a file while packaging.
Inherited from¶
forceCodeSigning?¶
readonlyoptionalforceCodeSigning:boolean
Whether to fail if app will be not code signed.
generateUpdatesFilesForAllChannels?¶
readonlyoptionalgenerateUpdatesFilesForAllChannels:boolean
Please see Building and Releasing using Channels.
Default¶
false
icon?¶
readonlyoptionalicon:null|string
protocols?¶
The URL protocol schemes.
publish?¶
optionalpublish:Publish
Overrides¶
releaseInfo?¶
readonlyoptionalreleaseInfo:ReleaseInfo
The release info. Intended for command line usage:
-c.releaseInfo.releaseNotes="new features"
target?¶
readonlyoptionaltarget:null|string|TargetConfiguration| (string|TargetConfiguration)[]
Metadata¶
Some standard fields should be defined in the package.json.
Electron-Builder / app-builder-lib / Metadata
Properties¶
author?¶
readonlyoptionalauthor:null|AuthorMetadata
build?¶
readonlyoptionalbuild:Configuration
The electron-builder configuration.
description?¶
readonlyoptionaldescription:string
The application description.
homepage?¶
readonlyoptionalhomepage:null|string
The url to the project homepage (NuGet Package projectUrl (optional) or Linux Package URL (required)).
If not specified and your project repository is public on GitHub, it will be https://github.com/${user}/${project} by default.
license?¶
readonlyoptionallicense:null|string
linux-only. The license name.
name?¶
readonlyoptionalname:string
The application name.
Required¶
repository?¶
readonlyoptionalrepository:null|string|RepositoryInfo
The repository.
Proton Native¶
To package Proton Native app, set protonNodeVersion option to current or specific NodeJS version that you are packaging for.
Currently, only macOS and Linux supported.
Build Version Management¶
CFBundleVersion (macOS) and FileVersion (Windows) will be set automatically to version.build_number on CI server (Travis, AppVeyor, CircleCI and Bamboo supported).
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 Same setup as beforePack
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). Same setup as beforePack
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). Same setup as beforePack
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. Same setup as beforePack
artifactBuildStarted?¶
readonlyoptionalartifactBuildStarted:null|string|Hook<ArtifactBuildStarted,any>
The function (or path to file or module id) to be run on artifact build start. Same setup as beforePack
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