https://github.com/teneplaysofficial/cli-update-notifier
Notify users of CLI updates
https://github.com/teneplaysofficial/cli-update-notifier
cli update-notifier version-checker
Last synced: 10 months ago
JSON representation
Notify users of CLI updates
- Host: GitHub
- URL: https://github.com/teneplaysofficial/cli-update-notifier
- Owner: TenEplaysOfficial
- License: mit
- Created: 2025-07-01T09:33:45.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-07-10T15:40:59.000Z (11 months ago)
- Last Synced: 2025-07-10T21:59:03.216Z (11 months ago)
- Topics: cli, update-notifier, version-checker
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/cli-update-notifier
- Size: 43.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
cli-update-notifier
_Notify users of CLI updates_
## Preview

## Install
```sh
npm install cli-update-notifier
# or
yarn add cli-update-notifier
```
## Usage
### Basic
```js
import notify from "cli-update-notifier";
await notify("react", "18.2.0");
```
### Using `package.json`
```js
import notify from "cli-update-notifier";
import pkg from "./package.json";
await notify(pkg.name, pkg.version);
```
## API
```ts
notify(
name: string,
currentVersion: string,
title?: string = "Update Available",
titleAlignment?: "left" | "center" | "right",
padding?: number = 1,
borderColor?: string = "green",
): Promise
```
### Parameters
| Name | Type | Default | Description |
| ---------------- | ------------------------------- | -------------------- | -------------------------------- |
| `name` | `string` | — | **(required)** NPM package name. |
| `currentVersion` | `string` | — | **(required)** Your version. |
| `title` | `string` | `"Update Available"` | Box header. |
| `titleAlignment` | `"left" \| "center" \| "right"` | `"center"` | Title text alignment. |
| `padding` | `number` | `1` | Inner box padding. |
| `borderColor` | `string` | `"green"` | Boxen border color. |
## How It Works
1. Detects package manager via `npm_config_user_agent`.
2. Fetches `latest` version using `npm-metadata`.
3. Compares with `currentVersion`. If identical, does nothing.
4. Builds a formatted message of current and latest versions + update command.
5. Outputs a styled box using `boxen` and `chalk`.
## Example
```js
import notify from "cli-update-notifier";
import { name, version } from "./package.json";
await notify(name, version);
```
When an update is found, users see:

## Supported Package Managers
Package manager is auto‑detected:
- `npm`: `npm i -g `
- `yarn`: `yarn global add `
- `pnpm`: `pnpm add -g `
- `bun`: `bun add -g `
## Why Use This?
- Lightweight and fast
- Works with all major package managers
- Stylish, clear CLI updates
- Silent when no updates
## Contributing
Contributions welcome! Please:
1. Fork the repo
2. Create a new branch (`git checkout -b feature/...`)
3. Add tests or docs
4. Submit a PR
## License
MIT License