Installing and managing packages using npm is great! What I don't find so great is the mess it can leave.
I've started using npm for both client and node dependency management and I've noticed lots of different arrangements for the various packages I rely on. Some have lib
folders, some have src
folders, some dist
, some docs
, some examples
Etc.
I understand that this is because generally these packages come directly from source.
My question is:
Is there a way of identifying or even automating the removal of any unneeded files, for deployment to production? I'm thinking: removal of any readme.md (easy enough I guess) or example files (probably easy enough).
Ideally I'd like to be able to calculate exactly what the dependency tree looks like from my entry point and delete unneeded / unused files ... This is obviously a lot harder for client packages that rely on images or fonts or HTML for example.
EDIT:
As pointed out by Alexander Mac (below) A good strategy for front-end dep's is to include client dependencies as dev-dependencies and build. So my question is only related to nodejs apps.