https://github.com/scrwdrv/startup-update-check
Check your custom CLI tool version with npm at startup and notify users if a newer version is published.
https://github.com/scrwdrv/startup-update-check
cli custom-cli notify-users npm startup update version-check
Last synced: 3 months ago
JSON representation
Check your custom CLI tool version with npm at startup and notify users if a newer version is published.
- Host: GitHub
- URL: https://github.com/scrwdrv/startup-update-check
- Owner: scrwdrv
- License: mit
- Created: 2020-01-21T03:48:03.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-06-28T23:11:18.000Z (about 2 years ago)
- Last Synced: 2025-03-10T11:48:10.847Z (4 months ago)
- Topics: cli, custom-cli, notify-users, npm, startup, update, version-check
- Language: TypeScript
- Size: 7.81 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# startup-update-check
Check your custom CLI tool version with npm at startup and notify users if a newer version is published.## Installation
```sh
npm i startup-update-check
```## Usage
### Provide path of `package.json`
```js
import checkUpdate from 'startup-update-check';checkUpdate('./package.json').then((newerVersion) => {
if (newerVersion) {
//do your things
} else if (newerVersion === null) {
//up to date
}
}).catch((err) => {
console.log(err);
});
```
### Specify package name and version directly
```js
checkUpdate({
name: 'safe-backup',
version: '1.2.5'
}).then((newerVersion) => {
if (newerVersion) {
//do your things
} else if (newerVersion === null) {
//up to date
}
}).catch((err) => {
console.log(err);
});
```