Packaging and distribution
When we worked with File Explorer and NW.js, we used the nwjs-builder
tool for packaging our application. The Electron has an even more sophisticated tool--electron-builder (https://github.com/electron-userland/electron-builder). Actually, it builds an application installer. The range of target package formats electron-builder supports is impressive. Then, why not try packaging our application? First, we install the tool:
npm i -D electron-builder
We add a new script to the manifest--./package.json
:
"scripts": { ... "dist": "build" },
We also set an arbitrary ID for the application in field build:
"build": { "appId": "com.example.chat" },
We definitely want to provide the application with an icon, so we create the build
subdirectory and place their icon.icns
for macOS, icon.ico
for Windows there. Icons for Linux will be extracted from icon.icns
. Alternatively, you can place icons in build/icons/
named after their sizes--64x64.png
.
In fact,...