wojtkowiak / meteor-desktop

Build a Meteor's desktop client with hot code push.
MIT License
448 stars 84 forks source link

How to AutoUpdate? #193

Open advancedsoftwarecanada opened 6 years ago

advancedsoftwarecanada commented 6 years ago

It isn't precisely clear how to have my desktop client update to the latest version.

I have Windows + Meteor + AndroidSDK + Java running fine. I've built the installer, works great. I can connect to my production URL and it works.

However, I do not understand what exactly is required in an easy to understand tutorial how to make this work.

Sincerely, Andy

lunafi-evan commented 6 years ago

It looks like using electron-updater would be the right solution here, at least if you're using electron-builder and not electron-packager

lunafi-evan commented 6 years ago

electron-updater has to be run in the main process. Within the design of meteor-desktop, you only have access to the main process in your .desktop/desktop.js file, so it seems like you could just add the electron-updater npm package to your project and use it like the example in the docs, granted you've set up your publishing pipeline correctly.

import { autoUpdater } from "electron-updater"

export default class AppUpdater {
  constructor() {
    const log = require("electron-log")
    log.transports.file.level = "debug"
    autoUpdater.logger = log
    autoUpdater.checkForUpdatesAndNotify()
  }
}