Skip to content

Latest commit

 

History

History
73 lines (56 loc) · 2.55 KB

README.md

File metadata and controls

73 lines (56 loc) · 2.55 KB

advanced-ahoy template

This extends on the simple setup adding:

  • icons
  • signing + notiarizing config
  • a patch for Windows setup
  • automated publishing of releases to Github
    • make sure you pushed the associated git tag to GH first

Setup

To run this in development mode, clone this repo down, then :

$ cd ssb-ahoy/templates/advanced
$ npm i
$ npm run dev

To build an installer/ executable :

$ npm run release

Produces an installer of ~81MB (for AppImage)

How this setup works

Differnt parts of the app are "built":

  • npm run build:main bundles the main.js electron process up into main.bundle.js
    • this makes for faster startup (electron doesn't have to read thousands of files)
    • AND it grabs only the files required (a light tree-shake)
    • noderify reads config in .noderifyrc
  • npm run build:ui bundles the UI up into a bundled version (this is mocked here)

Then we build the installer, following builder/config.js instructions

  • grab the files needed
    • main.bundle.js
    • the bundled ui (just the whole folder)
    • some native dependencies which have prebuilt binaries (sodium-native, leveldown stuff)
    • an ssb-ahoy script used for adding a simple API to the electron window
  • use the icons for platform we're building

We then do some platform specific modifications:

  • Mac
    • signing: see electron-builder.env where certificate secrets are stored
    • notarizing: see the afterSign notarize script and lines marked // N
      • this is super slow annoying step when you have to send a copy of the whole installer to Apple for signing.
  • Windows
    • patching a missing dll: see builder/config.js, win.nsis.include: 'builder/win/add-missing-dll.nsh'
    • signing: see electron-builder.env where certificate secrets might be stored (depends on cert type)
  • Linux (nothing)

Finally we auto-publish the new release to Github

  • see bulder/config.js, publish
  • see electron-builder.env where Github Tokens can be stored

Bonus

If your UI bundling is fancy, it might care what targets it's bundling for. Because we're using an exact electron version, we can pin this in our package.json browerserslist and get smaller, modern-only bundles.

🔥 WARNING

This setup uses electron-builder.env file to store

  • code signing secrets
  • github tokens for publishing

THIS FILE SHOULD NEVER BE COMMITTED (add it to your .gitignore) You can include an electron-builder.env.template with junk secrets to show other devs what their local copy could look like