How can I set my node application out of date for old version?

Viewed 73

I have 1 node library called sample, and anyone who would like to use my library must install it using npm i sample --save.

Let say the current version of sample is 3.0.0 and I would like to mark the version < 2.0.0 to be out-of-date.

E.g., client A installs library@1.0.0 should get out-of-date warning when running npm outdated.

How can I configure my sample?

2 Answers

There is a subcommand in npm called deprecate.

You can use the subcommand like this npm deprecate <pkg>[@version] <message>

To get more detailed explanation of the command and example , from the terminal run npm help deprecate

You can use npm deprecate. Basically you can run the following command:

npm deprecate library@"<2.0.0" "All versions older than v2.0.0 are deprecated."

Docs: https://docs.npmjs.com/cli/deprecate

Related