librariesio / libraries.io

:books: The Open Source Discovery Service
https://libraries.io
GNU Affero General Public License v3.0
1.1k stars 206 forks source link

NPM: change deprecation logic to only require latest non-prerelease to be deprecated #3334

Closed tiegz closed 3 months ago

tiegz commented 3 months ago

These changes tweak the behavior of NPM deprecation detection again:

Background

pre-March 2023

we marked an NPM package as "Deprecated" if the latest-release had a "deprecation" message in the API.

March 2023

we changed the logic to require all releases to have a "deprecation" message for the package to be marked as "Deprecated". This was for two reasons:

Mar 2024

in this PR, we go back to the latest-release only for detection, but we ignore any version that's a prerelease, to handle the case of "graphql" where the latest version may be a deprecated prerelease.

Why?

despite the aforementioned npm deprecate logic, there's conflicting behavior on npmjs.com where a package page will be display as deprecated if the latest non-prerelease release is deprecated, even if the older releases aren't deprecated. For example, @types/faker:

https://www.npmjs.com/package/@types/faker

Screenshot 2024-03-19 at 5 39 49 PM Screenshot 2024-03-19 at 5 39 57 PM

since there's not a first-class "deprecation" for packages in NPM, we have to pick a side, and users who visit NPM will think that this example means that the package is deprecated. If Libraries doesn't mark the package as deprecated, this will lead to more confusion.