UNPKG

2.81 kBMarkdownView Raw
1# Electron App Update Notifier
2
3[![downloads](https://badgen.net/npm/dt/electron-update-notifier)](https://npm-stat.com/charts.html?package=electron-update-notifier&from=2020-12-01)
4[![npm-version](https://badgen.net/npm/v/electron-update-notifier)](https://www.npmjs.com/package/electron-update-notifier)
5[![github-tag](https://badgen.net/github/tag/ankurk91/electron-update-notifier)](https://github.com/ankurk91/electron-update-notifier/tags)
6[![license](https://badgen.net/github/license/ankurk91/electron-update-notifier)](LICENSE.txt)
7[![install size](https://packagephobia.com/badge?p=electron-update-notifier)](https://packagephobia.com/result?p=electron-update-notifier)
8[![build](https://github.com/ankurk91/electron-update-notifier/workflows/build/badge.svg)](https://github.com/ankurk91/electron-update-notifier/actions)
9![ts](https://badgen.net/badge/Built%20With/TypeScript/blue)
10
11Notify user about new app updates by fetching release from Github repository.
12
13![screenshot](/.github/static/update-dialog.png)
14
15## Motivation
16
17[update-electron-app](https://github.com/electron/update-electron-app) is an auto updating solution for open source
18Electron apps. It is awesome but has some limitations:
19
20- It does not support Linux currently
21- Applications on macOS must be signed in order to work.
22
23This package comes to help in these cases. Instead of downloading installer automatically, it simply notifies user to go
24to GitHub release page when updates available.
25
26## Installation
27
28```sh
29npm install electron-update-notifier
30```
31
32## Usage
33
34Auto check for updates on app start
35
36```js
37const {app} = require('electron');
38const {setUpdateNotification} = require('electron-update-notifier');
39
40app.whenReady().then(() => {
41 setUpdateNotification({
42 repository: 'user/repo', // Optional, use repository field from your package.json when not specified
43 token: '', // Optional, GitHub api access token
44 debug: false, // Optional, default `false`, allows to check for updates during development as well
45 silent: true // Optional, notify when new version available, otherwise remain silent
46 })
47})
48```
49
50Check for updates manually
51
52```js
53const {checkForUpdates} = require('electron-update-notifier');
54
55checkForUpdates({
56 // options
57 silent: false, // Warn about network failures and notify when there is no updates
58})
59```
60
61Use it with [update-electron-app](https://github.com/electron/update-electron-app):
62
63```js
64switch (process.platform) {
65 case 'darwin':
66 case 'win32':
67 require('update-electron-app')()
68 break
69 default:
70 require('electron-update-notifier').setUpdateNotification({
71 // options
72 })
73}
74```
75
76## Acknowledgements
77
78[@pd4d10](https://github.com/pd4d10) for original work
79
80## License
81
82[MIT](LICENSE.txt) License