Closed mixonic closed 9 years ago
Testing with some Real World usage right now, getting a list for cleanup...
:rocket: :-D
@mixonic :+1: Thanks, that's a lot of work. I will review and merge asap.
@quaertym Would you also be open to another PR after this that makes creating fixture directory/file-structures on a per-test basis possible? We started pushing the limits of the fixtures when we put this together.
We have a followup for this after https://github.com/ember-cli/ember-cli/pull/3771 lands, which you review as a diff at https://github.com/201-created/ember-cli-dependency-checker/compare/add-shrinkwrap...201-created:using-node-modules-path. This patch will add support for arbitrary node_modules/
locations to the dependency checker.
But we would like to land this first.
LGTM
@quaertym I'd like to get this and the followup to it merged this week while we have it fresh in our heads, please let me know if we need to make any changes!
@mixonic I left a few comments let's figure them out, other than those I am fine with the changes. I think this is a great addition to the dependency checker, thanks for the great work.
@bantic I'd like any PR that improves the current situation.
@quaertym updated for one comment and addressed two others.
@mixonic Thanks :+1:
:fireworks:
The dependency checker is slightly naive, in that it presumes dependencies of dependencies do not require confirmation. We're only talking NPM here.
In practice, we've often run into cases where dependency X has a variable version specified, for example:
When
popup-service
releases1.0.1
, it is easy to end up with some npm installs having1.0.0
on disk and others having1.0.1
. The checker has no way to confirm what version should be installed, as that information is not stored inpackage.json
.Even worse is when
1.0.1
has a bug, but there is no way to force1.0.0
without forkingtorii
.The
npm shrinkwrap
command outputs a summary of what dependencies are currently innode_modules/
. There is no way to confirm that what you havenode_modules/
matchesnpm-shrinkwrap.json
, but removing thenode_modules/
directory and runningnpm install
will result in the versions ofnpm-shrinkwrap.json
being used.These patches add a new dependency checker to the
bower.json
andpackage.json
checkers, one that activates whennpm-shrinkwrap.json
is present and uses it to confirm the contents of thenode_modules/
directory is correct.The ideal way to work with this change is to run the
npm shrinkwrap
command and commit the resultingnpm-shinkwrap.json
command after everynpm install
of a dependency. When other developers (or a build box) pull down the changes theember
command will error if their nested dependencies are incorrect. The suggested resolution to failures is torm -rf node_modules/
and runnpm install
. With a blanknode_modules/
directory, npm will respect the pinned versions innpm-shrinkwrap.json
.See also the revised README.md.