electron-builder to package the application for different platforms. This guide covers building the app for production releases.
Build configuration
The build configuration is defined inelectron-builder.yml at the root of the project:
Platform-specific settings
- Windows
- macOS
- Linux
- Target: NSIS installer (Windows)
- Icon: Uses
build/icon.ico - Installation: Per-machine installation (requires admin)
- Publishing: Configured for GitHub Releases
Build scripts
Thepackage.json includes several build scripts:
Available commands
npm run pack
npm run pack
Builds the app without packaging into an installer.Output: Unpacked application in
dist/ directory (faster for testing)Use case: Testing the built app without creating installersnpm run dist:win
npm run dist:win
Builds a Windows installer.Output:
dist/gSubs Setup X.X.X.exe- NSIS installerdist/win-unpacked/- Unpacked application
npm run dist:mac
npm run dist:mac
Builds a macOS disk image.Output:
dist/gSubs-X.X.X.dmg- macOS disk imagedist/mac/gSubs.app- Application bundle
npm run dist:linux
npm run dist:linux
Builds Linux packages.Output:
dist/gSubs-X.X.X.AppImage- Universal Linux packagedist/gsubs_X.X.X_amd64.deb- Debian packagedist/gsubs-X.X.X.x86_64.rpm- RPM package
Building for all platforms
To build for multiple platforms at once, you can modify the build command. However, note that: If you want to build for all platforms in one command:Cross-platform builds have limitations. For best results:
- Build Windows on Windows or use CI/CD
- Build macOS on macOS (required for code signing)
- Build Linux on Linux or macOS
Build process
Prepare the build
Ensure all changes are committed and the version number in
package.json is updated:Build artifacts
After building, you’ll find these files in thedist/ directory:
| Platform | File | Description |
|---|---|---|
| Windows | gSubs Setup X.X.X.exe | NSIS installer |
| macOS | gSubs-X.X.X.dmg | Disk image |
| Linux | gSubs-X.X.X.AppImage | Universal Linux package |
| Linux | gsubs_X.X.X_amd64.deb | Debian/Ubuntu package |
| Linux | gsubs-X.X.X.x86_64.rpm | Fedora/RHEL package |
Code signing
Windows code signing
Add toelectron-builder.yml:
macOS code signing
Add toelectron-builder.yml:
Publishing
The Windows configuration includes GitHub publishing:- Build the app
- Create a draft release on GitHub
- Upload the installer as a release asset
Troubleshooting
Build fails on native modules
Rebuild native modules for the correct Electron version:Out of memory errors
Increase Node.js memory limit:Missing build directory
Ensure thebuild/ directory exists with platform icons:
build/icon.ico(Windows)build/icon.icns(macOS)build/icon.png(Linux)
Next steps
Contributing
Learn how to contribute your changes
Architecture
Understand the codebase structure