electron-forge-make-nsis
v1.0.0
Published
An `electron-forge` maker for NSIS that supports `electron-forge` v6 and can be used as a replacement for `electron-builder`. Supports code-signing and basic updates with `electron-updater`.
Readme
@electron-forge/maker-nsis
An electron-forge maker for NSIS that supports electron-forge v6 and can be used as a replacement for electron-builder. Supports code-signing and basic updates with electron-updater.
Features
- Creates Windows installers using NSIS (Nullsoft Scriptable Install System)
- Supports code-signing for Windows applications
- Compatible with
electron-forgev6 - Supports basic updates with
electron-updater - Cross-architecture support (x64, ia32, arm64)
Installation
npm install --save-dev @electron-forge/maker-nsisConfiguration
To use this maker, add it to your electron-forge configuration in package.json:
{
"config": {
"forge": {
"packagerConfig": {},
"makers": [
{
"name": "@electron-forge/maker-nsis",
"config": {
// Optional: Code signing configuration
"codesign": {
"certificateFile": "./path/to/certificate.p12",
"certificatePassword": "your-certificate-password",
"signingHashAlgorithms": ["sha256"],
"timestampServer": "http://timestamp.digicert.com"
},
// Optional: Auto-updater configuration
"updater": {
"url": "https://your-update-server.com",
"channel": "latest",
"publisherName": ["Your Company Name"]
},
// Optional: Additional app-builder-lib configuration
"getAppBuilderConfig": async () => {
return {
// Additional app-builder-lib configuration
"productName": "My App",
"artifactName": "${productName}-Setup-${version}.${ext}",
"compression": "maximum",
"oneClick": false,
"allowToChangeInstallationDirectory": true
};
}
}
}
]
}
}
}Configuration Options
Code Signing Options
codesign: Configuration object for Windows code signingcertificateFile: Path to the signing certificate filecertificatePassword: Password for the certificate filesigningHashAlgorithms: Array of hash algorithms to use for signing (e.g., ["sha256"])timestampServer: URL for the timestamp server
Auto-updater Options
updater: Configuration object for electron-updater compatibilityurl: Base URL for update fileschannel: Update channel (default: "latest")publisherName: Array of publisher names for the app-update.yml fileupdaterCacheDirName: Optional cache directory name for updates
Advanced Configuration
getAppBuilderConfig: Async function that returns additional configuration for app-builder-lib
Usage
Once configured, you can build your installer with:
npm run makeThis will generate a Windows NSIS installer in the out/make directory.
Code Signing
To properly sign your Windows application:
- Obtain a valid code signing certificate from a trusted Certificate Authority
- Configure the
codesignoption with the path to your certificate file and its password - Run the make command - your application will be automatically signed during the build process
Auto-updater Support
This maker includes built-in support for electron-updater:
- Configure the
updateroption with your update server URL - Include
electron-updaterin your application dependencies - Publish your updates to the specified URL
- The installer will include an
app-update.ymlfile thatelectron-updaterwill use
Development
To build the maker from source:
npm run buildTo lint the source code:
npm run lintRequirements
- Node.js >= 20.0.0
- Windows platform for building (for code signing and NSIS compilation)
License
MIT License - see the LICENSE file for details.
