npm 5 introduced package-lock.json, of which the documentation is here.
It states that the file is intended to be included with version control, so anyone cloning your package and installing it will have the same dependency versions. In other words, you should not add it to your .gitignore file.
What it does not state is wether or not the file is intended to be included with a published package. This question could be rephrased as; should package-lock.json be included in .npmignore?
It cannot be published.
From the npm documentation:
See package-lock.json documentation on docs.npmjs.com.
However, you should be commiting your
package-lock.json
to git as per the documentation.hence the common message presented by npm:
EDIT: A more detailed explanation can be found here.