How to use the electron-updater.autoUpdater.autoInstallOnAppQuit function in electron-updater

To help you get started, we’ve selected a few electron-updater examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github project-slippi / slippi-desktop-app / app / main.dev.js View on Github external
import _ from 'lodash';
import os from 'os';
import { Storage, File } from '@google-cloud/storage';
import url from 'url'
import { autoUpdater } from 'electron-updater';
import log from 'electron-log';
import path from 'path';
import fs from 'fs-extra';
import ini from 'ini';
import semver from 'semver';
import MenuBuilder from './menu';

// Set up AppUpdater
log.transports.file.level = 'info';
autoUpdater.logger = log;
autoUpdater.autoInstallOnAppQuit = false;
log.info('App starting...');

const slippiProtocol = "slippi";
const platform = process.platform;
const appDataPath = app.getPath("appData");
const isProd = process.env.NODE_ENV === 'production';
const isDev = process.env.NODE_ENV === "development";

let mainWindow = null;
let didFinishLoad = false;

app.disableHardwareAcceleration();

if (process.env.NODE_ENV === 'production') {
  const sourceMapSupport = require('source-map-support');
  sourceMapSupport.install();
github AhKi / oh-my-desk / app / main / utils / __tests__ / update / autoUpdateConfig.spec.js View on Github external
it('should check default', () => {
    autoUpdateConfig();

    expect(autoUpdater.autoDownload).toBe(false);
    expect(autoUpdater.autoInstallOnAppQuit).toBe(true);
  });
github durasj / webamp-desktop / src / node / updates.js View on Github external
function checkForUpdatesAndNotify() {
  if (isDev) {
    console.warn('Updates are not checked in dev mode')
    return
  }

  autoUpdater.autoDownload = false
  autoUpdater.autoInstallOnAppQuit = false
  autoUpdater.fullChangelog = true
  autoUpdater.logger = log

  autoUpdater.on('update-available', (info) => {
    log.info('Got info about update available', info)
    electron.dialog.showMessageBox({
      type: 'none',
      buttons: ['Open', 'Cancel'],
      title: 'New version available',
      message: [
        `There is a new version ${info.version}.`,
        ` Would you like to open the download page?`,
      ].join(''),
      detail: htmlToText.fromString(
        info.releaseNotes.reduce((acc, n) =&gt; acc + n.version + '<hr>' + n.note, ''),
        { singleNewLineParagraphs: true }
github fttx / barcode-to-pc-server / electron / src / handlers / update.handler.ts View on Github external
doUpdate() {
        if (this.autoUpdate) {
            autoUpdater.autoDownload = true;
            autoUpdater.autoInstallOnAppQuit = true;
            autoUpdater.checkForUpdates().then(result => {
                console.log('Autoupdater:', result)
            });
        } else {
            autoUpdater.autoDownload = false;
            autoUpdater.autoInstallOnAppQuit = false;
        }
    }
github Gapminder / gapminder-offline / main.ts View on Github external
import { getLatestGithubTag, updateDataset } from './dataset-update';
import * as os from 'os';

require('node-fetch');

export const FEED_VERSION_URL = 'http://s3-eu-west-1.amazonaws.com/gapminder-offline/auto-update.json';
const packageJSON = require('./package.json');
const dsGithubOwner = 'open-numbers';
const dsGithubRepo = 'ddf--gapminder--systema_globalis';
const isPortable = !!process.env.PORTABLE_EXECUTABLE_DIR;
const ga = new GoogleAnalytics(packageJSON.googleAnalyticsId, app.getVersion());

autoUpdater.logger = log as any;
(autoUpdater.logger as any).transports.file.level = 'info';
autoUpdater.autoDownload = false;
autoUpdater.autoInstallOnAppQuit = false;

const args = process.argv.slice(1);
const devMode = process.argv.length > 1 && process.argv.indexOf('dev') > 0;
const nonAsarAppPath = app.getAppPath().replace(/app\.asar/, '');
const userDataPath = (app || remote.app).getPath('userData');
const datasetPath = path.resolve(nonAsarAppPath, 'ddf--gapminder--systema_globalis');
const serve = args.some(val => val === '--serve');

let dataPackage = require(path.resolve(datasetPath, 'datapackage.json'));

let mainWindow;
let currentFile;
let isVersionCheckPassed = false;

function createWindow() {
  const isFileArgumentValid = fileName => fs.existsSync(fileName) && fileName.indexOf('-psn_') === -1;
github spacemeshos / smapp / desktop / main.dev.js View on Github external
constructor() {
    autoUpdater.logger = null;
    autoUpdater.autoInstallOnAppQuit = false;
    autoUpdater.autoDownload = true;
  }
}
github AhKi / oh-my-desk / app / main / utils / update / autoUpdateConfig.js View on Github external
function autoUpdateConfig() {
  const isDownloadUpdateWhenStart = isDownloadUpdateWhenStartSelector(store.getState());
  const isCheckUpdateWhenStart = isCheckUpdateWhenStartSelector(store.getState());

  autoUpdater.autoDownload = false;
  autoUpdater.autoInstallOnAppQuit = true;
  autoUpdater.on('download-progress', (downloadObj) => {
    const id = downloadProgressSelector(store.getState());

    store.dispatch(updateDownloadProgress(downloadObj, id));
  });

  autoUpdater.on('update-available', (updateInfo) => {
    const skipVersion = skipVersionSelector(store.getState());
    const nextVersion = updateInfo.version;
    const isUpdateCheckOnManual = isUpdateCheckOnManualSelector(store.getState());

    if (isUpdateCheckOnManual) {
      openUpdateWindow();
    } else if (isDownloadUpdateWhenStart) {
      store.dispatch(updateDownloadRequest());
    } else if (skipVersion !== nextVersion) {
github breeze2 / breader / main / updater.ts View on Github external
export type IUpdaterStatus =
  | 'UPDATER_CHECKING'
  | 'UPDATER_DOWNLOADING'
  | 'UPDATER_ERROR'
  | 'UPDATER_NORMAL'
  | 'UPDATER_READY'
export const UPDATER_STATUS_MAP: { [key: string]: IUpdaterStatus } = {
  CHECKING: 'UPDATER_CHECKING',
  DOWNLOADING: 'UPDATER_DOWNLOADING',
  ERROR: 'UPDATER_ERROR',
  NORMAL: 'UPDATER_NORMAL',
  READY: 'UPDATER_READY',
}

autoUpdater.autoDownload = false
autoUpdater.autoInstallOnAppQuit = false

let updaterStatus: IUpdaterStatus = UPDATER_STATUS_MAP.NORMAL

function setUpdaterStatus(status: IUpdaterStatus, meta?: any) {
  updaterStatus = status
  const menu = Menu.getApplicationMenu()
  if (!menu) {
    return
  }
  for (const i in UPDATER_STATUS_MAP) {
    if (UPDATER_STATUS_MAP[i]) {
      const item = menu.getMenuItemById(UPDATER_STATUS_MAP[i])
      item.visible = item.id === updaterStatus
    }
  }
  Menu.setApplicationMenu(menu)
github zxch3n / PomodoroLogger / src / main / AutoUpdater.ts View on Github external
download() {
        autoUpdater.autoInstallOnAppQuit = true;
        autoUpdater.downloadUpdate();
    }
}