normalize-package-data
normalize-package-data copied to clipboard
[QUESTION] Have a way to just check for correctness (i.e. whether there are warnings) ?
Originally, I thought that it would be best to separate the code for generating warnings from the code that make changes to data. But that was before I thought of the (quite elegant) solution of passing a warn function along.
However, it may be interesting to check for package.json validity (perhaps on several levels of correctness) while leaving the package data alone.
The consumer of this function could also do it by himself, by calling normalize on a cloned object, and pass a "warn" function that (for example) sets a "hasWarned" to true, then check this hasWarnings value afterwards.
Wouldn't it be best if npm publish rejects a package.json that generates a warning?