# update-check

> Minimalistic update notifications for command line interfaces

Latest version **1.5.4** (published 2020-04-13) · MIT license · 4.0M weekly downloads

## Install

```sh
npm install update-check
pnpm add update-check
yarn add update-check
bun add update-check
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: high downloads; no vulnerabilities.

Warnings: no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.4 |
| Published | 2020-04-13 |
| First published | 2018-04-08 |
| Weekly downloads | 4.0M |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 169 |
| Author | leo |
| Maintainers | igorklopov, jamo, leo, matheuss, nkzawa, rauchg |
| Keywords | update, notifications, checker, notifier |

## Links

- npm: https://www.npmjs.com/package/update-check
- Repository: https://github.com/zeit/update-check
- Homepage: https://github.com/zeit/update-check#readme
- Issues: https://github.com/zeit/update-check/issues
- npm.io page: https://npm.io/package/update-check

## Dependencies (2)

- [registry-url](https://npm.io/package/registry-url.md) 3.1.0
- [registry-auth-token](https://npm.io/package/registry-auth-token.md) 3.3.2

## Alternatives

- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads
- [@okxweb3/coin-bitcoin](https://npm.io/package/@okxweb3/coin-bitcoin.md) — 1.5K weekly downloads

## Recent versions

- 1.5.4 (latest) — 2020-04-13
- 1.5.3 — 2019-01-09
- 1.5.2 — 2018-05-22
- 1.5.1 — 2018-05-18
- 1.5.0 — 2018-05-14
- 1.4.0 — 2018-04-30
- 1.3.2 — 2018-04-22
- 1.3.1 — 2018-04-09
- 1.3.0 — 2018-04-09
- 1.2.0 — 2018-04-09
- 1.1.0 — 2018-04-09
- 1.0.0 — 2018-04-08

## README

# update-check 

[![npm version](https://img.shields.io/npm/v/update-check.svg)](https://www.npmjs.com/package/update-check)
[![install size](https://packagephobia.now.sh/badge?p=update-check)](https://packagephobia.now.sh/result?p=update-check)

This is a very minimal approach to update checking for [globally installed](https://docs.npmjs.com/getting-started/installing-npm-packages-globally) 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.

You can read more about the reasoning behind this project [here](https://twitter.com/notquiteleo/status/983193273224200192).

## Usage

Firstly, install the package with [yarn](https://yarnpkg.com/en/)...

```bash
yarn add update-check
```

...or [npm](https://www.npmjs.com/):

```bash
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:

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

let update = null;

try {
	update = await checkForUpdate(pkg);
} catch (err) {
	console.error(`Failed to check for updates: ${err}`);
}

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:

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

let update = null;

try {
	update = await checkForUpdate(pkg, {
		interval: 3600000,  // For how long to cache latest version (default: 1 day)
		distTag: 'canary'   // A npm distribution tag for comparision (default: 'latest')
	});
} catch (err) {
	console.error(`Failed to check for updates: ${err}`);
}

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

## Contributing

1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
2. Link the package to the global module directory: `npm link`
3. 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](https://twitter.com/notquiteleo)) - [ZEIT](https://zeit.co)

---
_Source: https://npm.io/package/update-check · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
