javascriptnpmnpm-publish

What file name patterns does npm publish always ignore?


The documentation for the npm publish command says this regarding which files will be included in the package:

If the file matches certain patterns, then it will never be included, unless explicitly added to the "files" list in package.json, or un-ignored with a ! rule in a .npmignore or .gitignore file

What are those "certain patterns"?

This seems very vague for technical documentation. Is the list of patterns documented anywhere (outside of the source code)?

The context that brought this up -- I was recently publishing a Javascript package with a directory named src nested several levels in the file structure. This directory was entirely omitted from the resulting published package. Renaming the directory caused it to be included on a subsequent try. There was not an allow list in the package.json, and there were no matching entries in '.npmingore'. It seems my src directory fell into this category of "certain patterns", but a cursory Google didn't turn up any further detail.


Solution

  • The files matching the following patterns are always ignored when running npm publish:

    This is documented in the developer docs.