How To Automatically Clean A Node_modules Directory For A SCM Commit

- 1 answer

I am quite new with node.js. The feature of having my dependencies (from node_modules) in the same directory that the one of my project suits me.

I also wants to commit those dependencies with my project.

I started with a project that uses But when I take a look at the directory generated by npm after a npm install, there are examples files, documentation, readme files, benchmark data, changelogs, ... Lots of files that I do not want to commit in my git or subversion system.

Is there an automatic tool that shrinks the content of a node_modules directory to only keep what is needed?

If I read correctly the documentation of npm, I found nothing for that. There is a prune option, but it is to remove the unused dependencies.



No, there is not tool to do that. Generally the author of the module uses .npmignore to ignore any files which he doesn't want published. Examples, Docs, Readme, Changelogs are published by almost all authors.

The only way for you is to delete them and commit to git.