Skip to content

Commit

Permalink
auto-updater (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
bukinoshita committed Dec 29, 2017
1 parent 288cf43 commit d75d617
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ node_modules

# logs
npm-debug.log

# Certificates
Certificates.p12
5 changes: 5 additions & 0 deletions main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const isDev = require('electron-is-dev')
const prepareNext = require('electron-next')
const { resolve } = require('app-root-path')

// Utils
const autoUpdater = require('./updater')

// Prepare the renderer once the app is ready
app.on('ready', async () => {
await prepareNext('./renderer')
Expand All @@ -30,6 +33,8 @@ app.on('ready', async () => {
slashes: true
})

autoUpdater()

const url = isDev ? devPath : prodPath
mainWindow.loadURL(url)
})
Expand Down
15 changes: 15 additions & 0 deletions main/updater.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict'

const { app, autoUpdater } = require('electron')
const isDev = require('electron-is-dev')

module.exports = () => {
if (!isDev) {
const server = 'https://taskr.now.sh'
const feed = `${server}/update/${process.platform}/${app.getVersion()}`

autoUpdater.setFeedURL(feed)

return autoUpdater.getFeedURL()
}
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"build": "next build renderer && next export renderer",
"dist": "npm run build && build --dir",
"prod": "electron-builder",
"test": "xo"
"test": "xo",
"postinstall": "electron-builder install-app-deps"
},
"build": {
"appId": "taskr",
Expand All @@ -23,6 +24,9 @@
"mac": {
"category": "public.app-category.developer-tools",
"icon": "main/static/icon.icns"
},
"linux": {
"target": ["AppImage", "deb"]
}
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Usage

[Download the latest release!](https://github.com/bukinoshita/taskr/releases/download/0.0.1/taskr-0.0.1-mac.zip)
[Download the latest release!](https://taskr.now.sh/download)

## Contribute

Expand Down

0 comments on commit d75d617

Please sign in to comment.