shrinkhack
v1.0.0
Published
Works around prune bugs in npm 3.10.x to allow you to shrinkwrap your dependency tree
Downloads
1
Maintainers
Readme
Shrinkhack
The usefulness of this module will (hopefully) be short lived. This works around some bugs in npm to allow you to shrinkwrap without extra manual work.
What?
This module will clean up all extraneous
packages in node_modules
.
Why?
I <3 Shrinkpack. It's a fantastic tool that has sped up installs for my projects, both locally and in CI.
Unfortunately, there are some problems currently that prevent every project from being able to use it, including some of mine.
Problems
Shrinkwrap requires a minimum npm version of
3.10.4
npm versions <
3.10.6
&& =>3.10.4
have a bug that will install alldevDependencies
associated with any module you rely on. This means a lot of extraneous dependencies end up innode_modules
.Number 2 was fixed in npm
3.10.6
. BUT,3.10.6
introduced a bug that causes dependency trees with cycles to fail during shrinkwrap.npm prune
would solve the problem this module addresses, but it has not been updated for the flat dependency tree in npm 3, so it fails to prune all modules that it should.
How?
This module does the following:
- Run
npm list
(which does identify the correct list ofextraneous
packages, unlikenpm prune
) - Removes all those packages from
node_modules
- Runs again, which is necessary due to npm's flat dependency tree. Once a package is removed in a prior run, more dependencies are then identified by
npm list
as extraneous.