yeoman / update-notifier

Update notifications for your CLI app
BSD 2-Clause "Simplified" License
1.76k stars 132 forks source link

Update notifier not working with public npm package #201

Open vinaysharma14 opened 3 years ago

vinaysharma14 commented 3 years ago

System Information

Issue:

I need to show updates for a public npm package, Rapid React. Unfortunately update-notifier doesn’t seem to work. I debugged the notify() function by adding logs and found out the following.

Debugging:

console.log(!process.stdout.isTTY, suppressForNpm, !this.update); // false true true

// the if statement turns out to be true and code execution returns from here
if (!process.stdout.isTTY || suppressForNpm || !this.update || !semver().gt(this.update.latest, this.update.current)) {
    return this;
}

Code:

const updateNotifier = require('update-notifier');
const pkg = require('../package.json');

updateNotifier({ pkg }).notify();
mustafashykh commented 3 years ago

Any updates on this..