When you use npm to install a package to your project with the command npm install <package-name>, the name and version of the package appear...
For further actions, you may consider blocking this person and/or reporting abuse
There is also a lesser known
peerDependency
section for creators of libraries!peerDependency
is useful when your library requires an upstream application to have a dependency installed.An example is if you create a React component. You do not want to specify the dependency in the
dependency
section. It is possible this may create conflicts in the App. So instead you use thepeerDependency
section. This will tell the installer "Hey, this also needs React to work!"Other use-cases of
peerDependency
is if a library is optional. For example, if I am writing a library that outputs some text to the console, I might check to see ifcolors
is installed. If so, I will colorize the text, if not, then It'll just be black and white. It's up to the upstream application to install the dependency.Cheers!
Thanks for sharing, that's really useful!