npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

autoupdaty

v1.3.4

Published

Autoupdater for Electron/NW.js apps

Downloads

44

Readme

autoupdaty

Simple auto-updater for Electron/NW.js apps.

Checks for new versions and downloads them.

It has two modes:

  1. Download and verify a new asar/nw file.
  2. Download and verify a new installer

In our versions manifest, we specify runtimeVersion for every version. If the version has a different runtimeVersion, that requires we do a full update (mode #2), otherwise we can do ASAR-only update - mode #1.

Documentation

Init

new autoUpdater(options) - inits an instance of our auto-updater

Options

version - object describing our current version - the one we're running

Example

{ version: "2.1", runtimeVersion: "2.0", released: "Sun Dec 27 2015 18:41:58 GMT+0200 (EET)" }

manifestUrl - URL to .json of your versions manifest; could be an array of URLs if you want fallback(s)

downloadUrl - base URL of your download server

filter - filter function ran against every version from the manifest

fs - your own fs object; for example, for Electron apps use requre('original-fs')

Example

function(ver) { return !ver.isBeta }

getUpdateUrl - function to format the URL we get the new version from; arguments are getUpdateUrl(downloadUrl, isAsar, platform)

Can also return object of the format { url: "url to get from", ungzip: false, untar: false, dest: "file name", checksumUrl: ".." }

runtimeVerProp - property to use when parsing runtime version from the versions manifest; default is runtimeVersion

Versions manifest

Your versions manifest is a JSON file of array with objects describing each released version of your product.

[
  { version: "2.1", runtimeVersion: "2.0", released: "Sun Dec 27 2015 18:41:58 GMT+0200 (EET)" },
  { version: "2.2", runtimeVersion: "2.0", released: "Sun Dec 28 2015 18:00:00 GMT+0200 (EET)", isBeta: true }
]

The required properties are version, runtimeVersion and released. Other than that, you can add any property you want for use in your filter function.

Methods

autoupdater.check(cb) - checks for new versions

autoupdater.prepare(version, [ options , ] cb) - prepares a new version

This downloads the new version.

If our current version has the same runtime, it will only download the .asar file.

If the update URL to the ASAR file ends in .gz (as the default getUpdateUrl assumes), then we'll un-gzip it on download and save it without the .gz extension.

If we're running a different runtime, this will download a new installer / bundle for the new version. This will either be an .exe, .dmg or .tar.gz. Use your own getUpdateUrl to modify this, for example if you want to use .deb for Linux.

Difference to Squirrel, Electron's default auto-updater

This was built primarily for in-house use for NW.js. It isn't documented perfectly and developed for generic use cases, so please use Electron's auto-updater unless you're very brave.

The reason to use autoupdaty, if it was a bit more mature, would be that it's incredibly simple and doesn't require any external dependencies (such as Squirrel's .NET). In other words, if you're looking for something simpler, more hackable and obvious in the way it works.