How to automatically clean node_modules directory to commit SCM

I am brand new with node.js. The peculiarity of having my dependencies (from node_modules ) in the same directory as my project.

I also want to fix these dependencies with my project.

I started with a project that uses socket.io . But when I look at the directory generated by npm after npm install socket.io , there are examples of files, documentation, readme files, control data, change logs ... There are many files that I don’t want to commit to my git or disruptive system.

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

If I read the npm documentation correctly, I did not find anything for this. There is a prune parameter, but it should remove unused dependencies.

+3
version-control
source share
1 answer

No, there is no tool for this. Typically, a module author uses .npmignore to ignore any files that he does not want to publish. Examples, Docs, Readme, Changelogs are published by almost all authors.

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

+2
source share

All Articles