yeoman / update-notifier

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

Don't suggest to upgrade to lower version #192

Closed fregante closed 4 years ago

fregante commented 4 years ago

Fixes #181

I haven't investigated why this would happen in the first place, but I guess it could if you install a beta version.

Is that a bug in https://github.com/sindresorhus/latest-version?

sindresorhus commented 4 years ago

Is that a bug in sindresorhus/latest-version?

Not sure, but I don't think so, since I've seen this problem happen on non-beta versions too.

fregante commented 4 years ago

Yeah the 2 comments were unrelated. I think latest-version could return a version older than its supposed to, I don’t know what else could be happening. Is it still cached here?

slorber commented 3 years ago

Hi,

Not sure it's related but we got those messages reported here:

image

https://github.com/facebook/docusaurus/issues/4782

Any idea what could be happening?

slorber commented 3 years ago

Looks like this bug is caused by the async nature of this package: fetch the update, and only notify about it on the 2nd run.

As I have my own code to notify users, I think I should just backport your logic to my own notifier.

Wouldn't it make sense to somehow "erase" this.update data if on 2nd run we detech packageVersion is > latest fetched version? This could fix the issue in a more generic way?