Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexbrazier/simple-update-notifier
Simple update notifier to check for npm updates for cli applications
https://github.com/alexbrazier/simple-update-notifier
Last synced: 6 days ago
JSON representation
Simple update notifier to check for npm updates for cli applications
- Host: GitHub
- URL: https://github.com/alexbrazier/simple-update-notifier
- Owner: alexbrazier
- License: mit
- Created: 2022-06-23T22:24:48.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-04-13T14:09:39.000Z (9 months ago)
- Last Synced: 2024-12-13T09:03:18.320Z (13 days ago)
- Language: TypeScript
- Size: 595 KB
- Stars: 16
- Watchers: 3
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# simple-update-notifier [![GitHub stars](https://img.shields.io/github/stars/alexbrazier/simple-update-notifier?label=Star%20Project&style=social)](https://github.com/alexbrazier/simple-update-notifier/stargazers)
[![CI](https://github.com/alexbrazier/simple-update-notifier/workflows/Build%20and%20Deploy/badge.svg)](https://github.com/alexbrazier/simple-update-notifier/actions)
[![Dependencies](https://img.shields.io/librariesio/release/npm/simple-update-notifier)](https://www.npmjs.com/package/simple-update-notifier?activeTab=dependencies)
[![npm](https://img.shields.io/npm/v/simple-update-notifier)](https://www.npmjs.com/package/simple-update-notifier)
[![npm bundle size](https://img.shields.io/bundlephobia/min/simple-update-notifier)](https://bundlephobia.com/result?p=simple-update-notifier)
[![npm downloads](https://img.shields.io/npm/dw/simple-update-notifier)](https://www.npmjs.com/package/simple-update-notifier)
[![License](https://img.shields.io/npm/l/simple-update-notifier)](./LICENSE)Simple update notifier to check for npm updates for cli applications.
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
```bash
npm install simple-update-notifier
OR
yarn add simple-update-notifier
```## Usage
```js
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](https://docs.npmjs.com/adding-dist-tags-to-packages) 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