🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

update-check

Package Overview
Dependencies
Maintainers
6
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

update-check

Minimalistic update notifications for command line interfaces

Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
4.1M
-0.57%
Maintainers
6
Weekly downloads
 
Created
Source

update-check

This is a very minimal approach to update checking for globally installed packages.

Because it's so simple, the error surface is very tiny and your user's are guaranteed to receive the update message if there's a new version.

Usage

Firstly, install the package with yarn...

yarn add update-check

...or npm:

npm install update-check

Next, initialize it.

If there's a new update available, the package will return the content of latest version's package.json file:

const pkg = require('./package')
const update = require('update-check')(pkg)

if (update) {
    console.log(`The latest version is ${update.latest}. Please update!`)
}

That's it! You're done.

Configuration

If you want, you can also pass options to customize the package's behavior:

const pkg = require('./package')
const checkForUpdate = require('update-check')

const update = checkForUpdate(pkg, {
    interval: 3600000,  // For how long the latest version should be cached (default: 1 day)
    distTag: 'canary'   // A npm distribution tag to compare the version to (default: 'latest')
})

if (update) {
    console.log(`The latest version is ${update.latest}. Please update!`)
}

Contributing

  • Fork this repository to your own GitHub account and then clone it to your local device
  • Link the package to the global module directory: npm link
  • Within the module you want to test your local development instance of the package, just link it: npm link update-check. Instead of the default one from npm, node will now use your clone.

Author

Leo Lamprecht (@notquiteleo) - ZEIT

Keywords

update

FAQs

Package last updated on 09 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts