cli-update-check
v1.0.2
Published
Minimal, zero-config update checker for CLI tools
Downloads
398
Maintainers
Readme
Installation
npm install cli-update-checkBasic Usage
import { checkForCliUpdate } from "cli-update-check";
setTimeout(async () => {
const msg = await checkForCliUpdate({
name: "your-package-name",
version: "0.1.0",
});
if (msg) {
console.log(msg);
}
}, 0);Options
checkForCliUpdate({
name?: string; // npm package name
version?: string; // current version
installCommand?: string; // custom update command
});If name and version are not provided, they are resolved from the local
package.json. The function should be called from the project root in that case.
Behavior
- Returns a string when an update is available
- Returns null otherwise
- Never throws
- Never logs
- Never blocks CLI execution
