{"library":"simple-update-notifier","title":"CLI Update Notifier","description":"simple-update-notifier is a lightweight and straightforward utility designed to inform users of command-line interface (CLI) applications about available updates on npm. It works by checking the npm registry for newer versions of a specified package and, if an update is found, prints a non-intrusive notification to the terminal. The library is currently at version 2.0.0, released in June 2023, and maintains a fairly active release cadence with minor and patch updates for dependency management and minor enhancements, and less frequent major releases for breaking changes. A key differentiator is its simplicity and built-in caching mechanism, which prevents excessive API calls to npm by only checking for updates at a configurable interval (defaulting to once a day). It also includes options to control notification behavior in npm scripts and specify different npm `dist-tags`.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install simple-update-notifier"],"cli":null},"imports":["import updateNotifier from 'simple-update-notifier';","import packageJson from './package.json' assert { type: 'json' };","import type { NotifierOptions } from 'simple-update-notifier';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import updateNotifier from 'simple-update-notifier';\nimport packageJson from './package.json' assert { type: 'json' };\n\n// In a real CLI application, this would typically be called once at startup.\n// To demonstrate, we'll create a dummy package.json object if not found.\nconst pkgInfo = packageJson || {\n  name: 'my-cli-app',\n  version: '1.0.0',\n};\n\nasync function main() {\n  console.log('Running CLI app...');\n  await updateNotifier({\n    pkg: pkgInfo,\n    updateCheckInterval: 1000 * 60 * 60, // Check hourly for demo purposes\n    shouldNotifyInNpmScript: true, // Allow notifications in npm scripts for testing\n    debug: process.env.DEBUG_UPDATE_NOTIFIER === 'true', // Enable debug logging with env var\n  });\n  console.log('CLI app finished.');\n}\n\nmain();","lang":"typescript","description":"This quickstart demonstrates how to integrate `simple-update-notifier` into a CLI application. It shows importing the notifier and passing a `pkg` object (typically from `package.json`) along with optional configuration like `updateCheckInterval` and `shouldNotifyInNpmScript`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}