Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
iffy committed Feb 3, 2017
1 parent bd4e539 commit ac2504b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
This repo contains the bare minimum code to have an auto-updating Electron app using [`electron-updater`](https://github.com/electron-userland/electron-builder/tree/master/packages/electron-updater) with releases stored on GitHub.

**NOTE:** If you want to run through this whole process, you will need to fork this repo on GitHub and replace all instances of `iffy` with your GitHub username before doing the following steps.

1. First, install necessary dependencies with:

npm install
Expand Down
19 changes: 13 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
// See LICENSE for details.

const {app, BrowserWindow, Menu, protocol} = require('electron');
var electron = require('electron');
const log = require('electron-log');
const {autoUpdater} = require("electron-updater");

//-------------------------------------------------------------------
// Logging
//
// This logging setup is not required for auto-updates to work,
// but it sure makes debugging easier :)
//-------------------------------------------------------------------
autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = 'info';
log.info('App starting...');

//-------------------------------------------------------------------
// Define the menu
Expand Down Expand Up @@ -69,10 +80,6 @@ app.on('activate', () => {
//-------------------------------------------------------------------
// Auto updates
//-------------------------------------------------------------------
var {autoUpdater} = require("electron-updater");
let UPDATE_DOWNLOADED = false;
let update_window;

autoUpdater.on('checking-for-update', (ev) => {
console.log('Checking for update...');
})
Expand All @@ -95,4 +102,4 @@ autoUpdater.on('update-downloaded', (ev, releaseNotes, releaseName, releaseDate,
autoUpdater.quitAndInstall();
}, 5000)
})
autoUpdater.checkForUpdates()
autoUpdater.checkForUpdates()
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
"main": "main.js",
"description": "electron-updater example project",
"author": "Matt Haggard",
"devDependencies": {
"dependencies": {
"electron": "^1.4.15",
"electron-builder": "^12.3.1",
"electron-builder": "^12.3.1"
},
"dependencies": {
"electron-log": "^1.3.0",
"electron-updater": "^1.4.2"
},
"build": {
Expand Down
1 change: 1 addition & 0 deletions publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ if [ -z "$GH_TOKEN" ]; then
exit 1
fi

# This will build, package and upload the app to GitHub.
build --win --mac -p always

0 comments on commit ac2504b

Please sign in to comment.