Socket
Socket
Sign inDemoInstall

update-notifier

Package Overview
Dependencies
Maintainers
9
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

update-notifier

Update notifications for your CLI app


Version published
Weekly downloads
6M
increased by1.35%
Maintainers
9
Weekly downloads
 
Created

What is update-notifier?

The update-notifier npm package is used to inform users when a newer version of a particular npm package is available. It is particularly useful for CLI tools to notify users to update to the latest version.

What are update-notifier's main functionalities?

Basic Usage

This feature allows you to set up a basic notifier that checks for updates to the package specified in the package.json file. If an update is available, it will notify the user.

const updateNotifier = require('update-notifier');
const pkg = require('./package.json');

const notifier = updateNotifier({ pkg });

if (notifier.update) {
  notifier.notify();
}

Custom Message

This feature allows you to customize the message that is displayed to the user when an update is available.

const updateNotifier = require('update-notifier');
const pkg = require('./package.json');

const notifier = updateNotifier({ pkg });

if (notifier.update) {
  notifier.notify({
    message: 'Update available: ' + notifier.update.latest + '. Run `npm install -g ' + pkg.name + '` to update.'
  });
}

Check Interval

This feature allows you to set the interval at which the update check is performed. In this example, the check is performed once every 24 hours.

const updateNotifier = require('update-notifier');
const pkg = require('./package.json');

const notifier = updateNotifier({ pkg, updateCheckInterval: 1000 * 60 * 60 * 24 }); // 1 day

if (notifier.update) {
  notifier.notify();
}

Other packages similar to update-notifier

Keywords

FAQs

Package last updated on 31 Jan 2021

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

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