Simple update notifier to check for npm updates for cli applications
  • TypeScript 97.5%
  • JavaScript 2.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
dependabot[bot] 86454174b6
chore(deps): bump json5 from 2.2.1 to 2.2.3 (#18)
Bumps [json5](https://github.com/json5/json5) from 2.2.1 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.2.1...v2.2.3)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex Brazier <aejbrazier.apps@gmail.com>
2023-01-27 20:15:08 +00:00
.github Run workflow on PRs 2022-06-27 09:46:23 +01:00
src Add debug flag to simpleUpdateNotifier() (#15) 2022-11-24 16:48:47 +00:00
.babelrc Fix build to support node 8 (#1) 2022-06-26 10:33:19 +01:00
.gitattributes Add git attributes to fix windows build 2022-06-24 00:09:50 +01:00
.gitignore Fix handle prerelease (#4) 2022-06-27 10:01:04 +01:00
.prettierrc Add simple-update-notifier 2022-06-23 23:24:42 +01:00
CHANGELOG.md chore: release 1.1.0 2022-11-24 17:29:22 +00:00
CODE_OF_CONDUCT.md Add license and community files 2022-06-24 01:59:46 +01:00
CONTRIBUTING.md Add license and community files 2022-06-24 01:59:46 +01:00
LICENSE Add license and community files 2022-06-24 01:59:46 +01:00
package.json chore: release 1.1.0 2022-11-24 17:29:22 +00:00
README.md Add debug flag to simpleUpdateNotifier() (#15) 2022-11-24 16:48:47 +00:00
rollup.config.js Fix build to support node 8 (#1) 2022-06-26 10:33:19 +01:00
tsconfig.json Fix build to support node 8 (#1) 2022-06-26 10:33:19 +01:00
yarn.lock chore(deps): bump json5 from 2.2.1 to 2.2.3 (#18) 2023-01-27 20:15:08 +00:00

simple-update-notifier GitHub stars

CI Dependencies npm npm bundle size npm downloads License

Simple update notifier to check for npm updates for cli applications.

Demo in terminal showing an update is required

Checks for updates for an npm module and outputs to the command line if there is one available. The result is cached for the specified time so it doesn't check every time the app runs.

Install

npm install simple-update-notifier
OR
yarn add simple-update-notifier

Usage

import updateNotifier from 'simple-update-notifier';
import packageJson from './package.json' assert { type: 'json' };

updateNotifier({ pkg: packageJson });

Options

pkg

Type: object

name

Required
Type: string

version

Required
Type: string

updateCheckInterval

Type: number
Default: 1000 * 60 * 60 * 24 (1 day)

How often to check for updates.

shouldNotifyInNpmScript

Type: boolean
Default: false

Allows notification to be shown when running as an npm script.

distTag

Type: string
Default: 'latest'

Which dist-tag to use to find the latest version.

alwaysRun

Type: boolean
Default: false

When set, updateCheckInterval will not be respected and a check for an update will always be performed.

debug

Type: boolean
Default: false

When set, logs explaining the decision will be output to stderr whenever the module opts to not print an update notification