installer-infrastructure
v1.0.0
Published
Reusable installer generation for Electron apps — NSIS branding, assets, license page, user options
Maintainers
Readme
Installer Infrastructure
Reusable installer generation for Electron apps. Decouple NSIS branding, user options, and license activation from your app and share the same infrastructure across multiple projects.
What This Package Does
| Feature | Description |
|---------|-------------|
| Asset generation | Creates icon.ico, installerHeader.bmp, installerSidebar.bmp from a single Logo.png |
| NSIS config | Professional multi-step wizard with user choices (install path, shortcuts, etc.) |
| License page | Optional license paste step during install (for use with license-key systems) |
| EULA template | Configurable license.txt for the installer |
| CLI | npx install-generate-assets for asset-only generation |
Installation
npm install installer-infrastructureOr from a local path (monorepo / development):
npm install file:../PathofInstallingRequirements: Node.js 18+, electron-builder (optional peer, for NSIS builds)
Quick Start
Option A: Full preparation (recommended)
Generate all assets, installer.nsh, and license.txt in one call:
const path = require('path');
const { prepareInstaller } = require('installer-infrastructure');
prepareInstaller({
appName: 'Path of Rolling',
appDataFolder: 'Path of Rolling',
logoPath: path.join(__dirname, 'Logo.png'),
outputDir: path.join(__dirname, 'build'),
licenseFilename: 'license.json',
}).then(() => console.log('Installer prepared.'));Option B: Programmatic API
Use individual functions for fine-grained control:
const installer = require('installer-infrastructure');
// Generate assets only
await installer.generateInstallerAssets({
logoPath: './Logo.png',
outputDir: './build',
});
// Get electron-builder NSIS config (merge into your build config)
const nsisConfig = installer.getNsisConfig({
appName: 'My App',
buildDir: 'build',
});
// Get custom NSIS page content (license paste)
const nshContent = installer.getInstallerNshContent({
appName: 'My App',
appDataFolder: 'My App',
licenseFilename: 'license.json',
});
// Get EULA content
const licenseContent = installer.getLicenseTxtContent({ appName: 'My App' });Option C: CLI (assets only)
npx install-generate-assets
# Or with options:
npx install-generate-assets --logo ./Logo.png --output ./buildIntegration with electron-builder
- Call
prepareInstaller()(orgenerateInstallerAssets()+ manual nsh/license) before runningelectron-builder. - Merge
getNsisConfig()into yourpackage.jsonbuild section:
{
"build": {
"win": {
"target": "nsis",
"icon": "build/icon.ico"
},
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true,
"allowElevation": true,
"perMachine": false,
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"menuCategory": "My App",
"license": "build/license.txt",
"installerHeader": "build/installerHeader.bmp",
"installerSidebar": "build/installerSidebar.bmp",
"include": "build/installer.nsh",
"uninstallDisplayName": "My App"
}
}
}Or use getNsisConfig({ appName: 'My App' }) and merge programmatically.
License activation integration
The optional license paste page writes to %APPDATA%\YourApp\license.json. Use matching appDataFolder and licenseFilename in both this package and your license validation logic (e.g. license-key-infrastructure).
API Reference
See API.md for full function signatures, options, and TypeScript types.
Using in multiple projects
- Add
installer-infrastructureas a dependency. - Call
prepareInstaller()beforeelectron-builderwith your app name and paths. - Ensure
Logo.pngexists at your project root (or passlogoPath). - Share the same branding approach across all your Electron apps.
Publishing to npm
If you maintain this package and want to publish it:
- Ensure the package name is available (or use a scoped name like
@yourorg/installer-infrastructure). - Update
package.jsonwith your author and repository URLs. - Run:
npm login
npm publishFor a scoped package (e.g. @wisernage/installer-infrastructure):
npm publish --access public