npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

🔭 Looking for a package for deprecation messages

Not a showcase I’m afraid, but a request for help

I’m looking for a package to log deprecation messages. There is depd, but the problem is that it only logs a message once based on the file path and line number, even if the messages are different. I’m looking for a package that logs a deprecation message once, based on the message itself.

A simple version would be only a few lines of code which is what I did here: https://github.com/octokit/rest.js/blob/9d657e5b3a780e329a6675ee19387430be22deed/lib/deprecate.js

But there are some nice features that depd supports such as a global deprecation event, colored logging and environment variables to disable deprecations altogether or to log more information about where in the code the deprecated method or property is being used.

Any recommendations? Or maybe I’m approaching this wrong? What are your “deprecation best practises”? Would my use case be worth creating a new package? Thanks :bouquet: