Socket
Book a DemoInstallSign in
Socket

cli-update-notifier

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-update-notifier

Notify users of CLI updates

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

cli-update-notifier

Notify users of CLI updates

Preview

Preview

Install

npm install cli-update-notifier
# or
yarn add cli-update-notifier

Usage

Basic

import notify from "cli-update-notifier";

await notify("react", "18.2.0");

Using package.json

import notify from "cli-update-notifier";
import pkg from "./package.json";

await notify(pkg.name, pkg.version);

API

notify(
  name: string,
  currentVersion: string,
  title?: string = "Update Available",
  titleAlignment?: "left" | "center" | "right",
  padding?: number = 1,
  borderColor?: string = "green",
): Promise<void>

Parameters

NameTypeDefaultDescription
namestring(required) NPM package name.
currentVersionstring(required) Your version.
titlestring"Update Available"Box header.
titleAlignment"left" | "center" | "right""center"Title text alignment.
paddingnumber1Inner box padding.
borderColorstring"green"Boxen border color.

How It Works

  • Detects package manager via npm_config_user_agent.
  • Fetches latest version using npm-metadata.
  • Compares with currentVersion. If identical, does nothing.
  • Builds a formatted message of current and latest versions + update command.
  • Outputs a styled box using boxen and chalk.

Example

import notify from "cli-update-notifier";
import { name, version } from "./package.json";

await notify(name, version);

When an update is found, users see:

Preview

Supported Package Managers

Package manager is auto‑detected:

  • npm: npm i -g <name>
  • yarn: yarn global add <name>
  • pnpm: pnpm add -g <name>
  • bun: bun add -g <name>

Why Use This?

  • Lightweight and fast
  • Works with all major package managers
  • Stylish, clear CLI updates
  • Silent when no updates

Contributing

Contributions welcome! Please:

  • Fork the repo
  • Create a new branch (git checkout -b feature/...)
  • Add tests or docs
  • Submit a PR

License

MIT License

Keywords

cli

FAQs

Package last updated on 13 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts