- (assumption: npm is already installed)
npm init
and work through the Q&A- for
entrypoint
usemain.js
- for
npm install -g electron
npm install --save electron
- in
package.json
replacescript.test
with"start": "electron ."
(with this you can start the application while developing withnpm start
rather thanelectron .
) - create the
main.js
andindex.html
(or however you wanna call this html file) files
- in
main.js
we set the developer tools and reload functionality only if the environment is not in production, see theAdd developer tools item if not in production
comment - in
main.js
we can set the environment variable, see theSET ENV
comment
- see https://www.christianengvall.se/electron-packager-tutorial/
- npm install electron-packager --save-dev
- add scripts from the blog to
package.json
and modify for Windows--version-string.ProductName
to your own product name and for Linux--icon=assets/icons/png/icon.png
- download/point to the correct icons
- (to create the Windows release on Mac, you need to
brew cask install xquartz
andbrew install wine
first!) - run the package scripts (note: you can't run these in parallel!):
- Windows:
npm run package-win
- Mac:
npm run package-mac
- Linux:
npm run package-linux
- Windows: