Socket
Socket
Sign inDemoInstall

electron-updater

Package Overview
Dependencies
Maintainers
3
Versions
290
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-updater - npm Package Compare versions

Comparing version 0.3.1 to 1.1.0

out/api.js

65

package.json
{
"name": "electron-updater",
"version": "0.3.1",
"description": "Cross platform auto-updater for electron applications",
"main": "index.js",
"author": "Evolve LLC",
"version": "1.1.0",
"description": "NSIS Auto Updater",
"main": "out/main.js",
"author": "Vladimir Krivosheev",
"license": "MIT",
"keywords": [
"electron"
"repository": "electron-userland/electron-builder",
"bugs": "https://github.com/electron-userland/electron-builder/issues",
"homepage": "https://github.com/electron-userland/electron-builder",
"files": [
"out"
],
"homepage": "https://github.com/evolvelabs/electron-updater",
"repository": {
"type": "git",
"url": "https://github.com/evolvelabs/electron-updater.git"
},
"bugs": {
"url": "https://github.com/evolvelabs/electron-updater/issues"
},
"scripts": {
"test": "mocha",
"watch": "mocha --watch"
},
"bin": {
"electron-updater": "./bin/cli",
"elup": "./bin/cli"
},
"dependencies": {
"appdirectory": "^0.1.0",
"async": "^0.9.0",
"commander": "^2.8.1",
"glob": "^5.0.14",
"got": "^4.2.0",
"minimist": "^1.1.1",
"semver": "^4.3.3",
"spin": "0.0.1",
"tar-stream": "^1.1.4",
"unzip": "^0.1.11"
"bluebird-lst-c": "^1.0.6",
"fs-extra-p": "^3.1.0",
"js-yaml": "^3.7.0",
"semver": "^5.3.0",
"source-map-support": "^0.4.10",
"electron-builder-http": "11.5.0"
},
"bundledDependencies": [
"appdirectory",
"async",
"glob",
"got",
"minimist",
"semver",
"spin",
"tar-stream",
"unzip"
],
"devDependencies": {
"chai": "^2.3.0",
"mocha": "^2.2.4",
"proxyquire": "^1.4.0",
"sinon": "^1.14.1"
}
"typings": "./out/electron-auto-updater.d.ts"
}

@@ -1,147 +0,3 @@

# electron-updater
Cross platform auto-updater for electron apps
# electron-auto-updater
[![Build Status](https://travis-ci.org/EvolveLabs/electron-updater.svg?branch=master)](https://travis-ci.org/EvolveLabs/electron-updater)
# NOTE
This project is in maintainance only mode. It is recommended that you use the `electron-packager` and `electron-builder` projects to generate complete installable versions of your applications and use either the OS specific stores or some other mechanism for distributing your installers.
# Install
There are three main packages that make up the `electron-updater`.
$ npm install electron-updater --save
$ npm install electron-plugins --save
$ npm install electron-updater-tools -g
> **NOTE:** Requires electron version `>=0.33.3`.
The [electron-updater](htps://npmjs.org/package/electron-updater) package itself runs in your app's main process and does the actual updating. The [electron-plugins](https://npmjs.org/package/electron-plugins) project specifically loads the plugins downloaded by the updater in the render process. The third project, [electron-updater-tools](https://npmjs.org/package/electron-updater-tools) contains various scripts useful for building native electron addons as well as linking plugins during development time.
# Usage
Integrate the electron-updater into your electron main process. Below is a simplified example of the [Electron Quick Start](http://electron.atom.io/docs/latest/tutorial/quick-start/#write-your-first-electron-app) code with the `electron-updater` mixed in.
## Example main.js
```JavaScript
var app = require('app'),
BrowserWindow = require('browser-window'),
updater = require('electron-updater')
var mainWindow = null
app.on('ready', function() {
updater.on('ready', function () {
mainWindow = new BrowserWindow({width: 800, height: 600})
mainWindow.loadURL('file://' + __dirname + '/index.html')
mainWindow.openDevTools({detach:true})
mainWindow.on('closed', function() {
mainWindow = null;
})
})
updater.on('updateRequired', function () {
app.quit();
})
updater.on('updateAvailable', function () {
mainWindow.webContents.send('update-available');
})
updater.start()
})
```
## Example index.js (running in render process)
```JavaScript
var plugins = require('electron-plugins'),
electron = require('electron'),
ipc = electron.ipcRenderer
document.addEventListener('DOMContentLoaded', function () {
var context = { document: document }
plugins.load(context, function (err, loaded) {
if(err) return console.error(err)
console.log('Plugins loaded successfully.')
})
})
ipc.on('update-available', function () {
console.log('there is an update available for download')
})
```
# Error handling
By default errors are logged to both the console and a file. The default log file location is obtained by getting the [AppDirectory.userData()](https://www.npmjs.com/package/appdirectory) folder: `{userData}/logs/updater.log`. Additionally you can replace the default logger or simply handle errors manually with the below optional API's:
```
updater.on('error', function (err) {
// todo: manually handle errors here in addition to default logger behavior...
});
// The logger signature is essentially the same as the console.
var customLogger = {
log: console.log,
error: console.error,
info: console.info,
warn: console.warn,
debug: console.debug
};
updater.start(customLogger);
```
# Publishing Updates
There are two kinds of updates you can publish:
* The Application itself
* Plugins
Both kinds of updatable packages are distributed through [npm](http://npmjs.org). This means that publishing updates to your application and plugins are essentially done like this:
```
$ npm pack
$ npm pub
```
The application will periodically check npm for updates to any packages and update them when it can.
## Hosting your own npm server
If you are developing a commercial application, or just want to control distribution yourself, you should host your own packages on your own npm server.
Add a path to your registry in the applications `package.json`:
```
"registry": "http://npm.mycompany.com:4873",
```
To tell npm to use this registry also, create a [.npmrc file](https://docs.npmjs.com/files/npmrc) in your application root directory containing:
```
registry=http://npm.mycompany.com:4873
```
Fortunately, hosting your own npm server is very easy to do with [sinopia](http://npmjs.org/packages/sinopia).
```
$ npm install sinopia -g
$ sinopia
```
To run sinopia as a service, you can use [forever](http://npmjs.org/packages/forever).
```
$ npm install forever -g
$ forever start sinopia
```
## Plugins
Plugins are different than normal dependencies. To establish a link to a plugin, add a `plugins` entry into your applications `package.json`:
```
"dependencies": {
# ...
},
"plugins": {
"electron-updater-example-plugin": "~0.1.0"
},
```
When your application runs it will download and install these plugins into your users [AppDirectory.userData()](https://www.npmjs.com/package/appdirectory) folder. The main benefits of plugins is:
* Gauranteed user directory, does not require elevation to update.
* Supports side-by-side installation, so they can be updated while the app is running.
* Application can be refreshed instead of restarted to apply updates.
* Load arbitrary plugins using [electron-plugins](https://npmjs.org/packages/electron-plugins), instead of having fixed dependencies only.
In the `userData` folder there is also a `.current` file created, which is used to maintain the list of currently installed plugins. You can add items to that file to install non-default plugins.
# Distributing binaries
Until there is better documentation on this, see these issues for answers:
* https://github.com/EvolveLabs/electron-updater/issues/21
* https://github.com/EvolveLabs/electron-updater/issues/10
### Related
See the [`electron-builder`](https://www.npmjs.com/package/electron-builder) project for creating installers for
various platforms.
[Auto Update](https://github.com/electron-userland/electron-builder/wiki/Auto-Update).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc