Check what files in an npm project will be published
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Check what files in an npm project will be published


npm install unignored


var unignored = require('unignored')
unignored('./', function(err, files) {

Simply require unignored and pass it a path to the npm project you'd like to check. Files will be an array of file paths (relative to the path you passed in) that will be included when you run npm publish.


You can install the module globally and use it as a cli as well:

Usage: unignored [options]

  -p, --path     path to module (relative)    [default: "./"]
  -h, --help     Show help
  -v, --version  Show version number


Since creating this tool, I've found a few other modules that accomplish this same task like irish-pub and pkgfiles. They both include more features and are recommended if unignored doesn't work out for you.

NPM is very smart about which files are included and which are ignored by default. This is highly configurable with .gitignore, .npmignore, and the files key in package.json. Because these rules are slightly complex, it can be helpful to see what files all consumers of your module will have to download when they install it.

About NPM Ignore

This section of the manual explains this in pretty good detail.

Essentially, if there is no .npmignore, the .gitignore will be used. That means anything that you are ignoring from source control won't be part of your module when people npm install it.

If there is a files field in package.json, then that will dictate what files are included in the version.

If you have both files and .npmignore and they conflict, .npmignore will override the file and it will still be ignored.


Contributions are welcome! This project uses the standard style, so you should use it too! npm test will automatically make sure the code is written to the standard. If the tests pass, you are good to go!