/electron-nuxt

Electron application boilerplate based on Nuxt.js for crossplatform desktop application development

Primary LanguageJavaScript

Electron Nuxt

by WebspaceTeam

Electron application boilerplate based on Nuxt.js for crossplatform desktop application development

Electron Nuxt core components:

  • Electron
  • Electron builder
  • Nuxt.js

Building for Windows NSIS target works perfect. However, there are some tricky moments when you are building for MacOS (both DMG and Mac App Store distribution). See MacOS section.

Build Setup

# install dependencies
$ npm run install

# serve with hot reload for Renderer process
$ npm run dev

# build for Windows
$ npm run build:win:64
$ npm run build:win:32
$ npm run build:win:both

# build for MacOS
$ npm run build:mac:dmg
$ npm run build:mac:store

Folders structure

/build folder stores icon and additional scripts for Electon Builder

/mainprocess includes JavaScript for the Electron main process

/src folder structure typical to any Nuxt.JS project

MacOS

Key definitions

You need to create provisioning profile at developer.apple.com and place it to build folder as embedded.provisionprofile.

DMG distribution

To distribute your application as DMG image it should be signed and notarized.

To sign application change CERTIFICATE NAME (***********) in package.json file in build:mac:dmg section to yourth one.

To notarize application change apple@developer.id and application password in package.json file in build:mac:dmg section to yourth one.

Additionaly check (add or remove) entitlements at build/entitlements.mac.plist

Mac App Store distribution

Attention: currently only Electron 5.0.13 and 6.1.7 can be publised to Mac App Store. Do not forget to change Electron version in package.json

To publish application at Mac App Store it should be sandboxed and all binaries should be signed. Appropriate entitlements needs to be added.

Steps to prepare your application for publication:

  1. Change CERTIFICATE NAME (***********) in package.json file in build:mac:store section to yourth one.
  2. Check (add or remove) entitlements at build/entitlements.mas.plist. Replace DEVELOPERID.full.package.name in build/entitlements.mas.plist
  3. In build/resignAndPackage.sh change APPLICATION NAME to your application name (should be as productName in package.json). Replace CERTIFICATE NAME (***********) to your certificate name in two places.
  4. Binaries that are listed in build/resignAndPackage.sh valid for Electron 5.0.13. Should be updated for another Electron version or in case additional binaries will be used. To find binaries run find -H YourAppBundle -print0 | xargs -0 file | grep "Mach-O .*executable" (see source). Binaries from node_modules can be unpacked by listing them in asarUnpack key in package.json.
  5. Build dist/mas/$APP-mac_store.pkg should be uploaded to Mac App Store via Transporter application

Knowing issues

  • There is a bug in Electron builder. Only one target for mac can be specified.

Licence

MIT © Electron Nuxt by WebspaceTeam