I’m using the can
package, as opposed to individual deps themselves, which poses an issue when the deps of the can
package become outdated.
This very topic was discussed in the following contributors meeting:
One proposal was to use CI to have evergreen dependencies for the can
package. That would be convenient and work most of the time, however I could see this being insufficient after a major version bump when a pinned version of a dependency is used indirectly by multiple other dependencies.
Take for example my experience with can-view-live
:
$ npm ls can-view-live
my-project@0.0.1
└─┬ can@5.11.0
├─┬ can-stache@4.12.0
│ └── can-view-live@4.2.1 deduped
├─┬ can-stache-bindings@4.4.0
│ └── can-view-live@4.2.1 deduped
└── can-view-live@4.2.1
Currently, the can
package forces a fixed (older) version:
It seems the thinking is maintainers should know (and remember) to make a new release of the can
package immediately after pushing a hotfix to a can
package dependency. Unfortunately, it seems this hasn’t been the case for can-view-live
to which I believe a hotfix was pushed ~20 hours ago. It is still not reflected in a new can
package release. Luckily, those other packages that depend on can-view-live
use a version range that includes the bump.
can-stache
:
can-stache-bindings
:
So, I thought to just pin the can
package to the un-merged Greenkeeper PR branch:
$ npm i --save github:canjs/canjs#greenkeeper/can-view-live-4.2.2
+ can@5.11.0
added 1 package and updated 1 package in 14.767s
That worked to update the can-view-live
dependency at the top level, but nested dependencies were still using the older version of can-view-live
:
$ npm ls can-view-live
my-project@0.0.1
└─┬ can@5.11.0 (github:canjs/canjs#0ffc3526d14cb5e8c366203049e75c1dbc34367d)
├─┬ can-stache@4.12.0
│ └── can-view-live@4.2.1
├─┬ can-stache-bindings@4.4.0
│ └── can-view-live@4.2.1 deduped
└── can-view-live@4.2.2
I found that if I wanted the nested deps to go from 4.2.1
to 4.2.2
, it was necessary to blow away node_modules
and re-run npm install
:
$ rm -rf node_modules
$ npm install
This resulted in can-view-live@4.2.2
for all deps:
$ npm ls can-view-live
my-project@0.0.1
└─┬ can@5.11.0 (github:canjs/canjs#0ffc3526d14cb5e8c366203049e75c1dbc34367d)
├─┬ can-stache@4.12.0
│ └── can-view-live@4.2.2 deduped
├─┬ can-stache-bindings@4.4.0
│ └── can-view-live@4.2.2 deduped
└── can-view-live@4.2.2
However, if I needed to update more than just the one can-view-live
dependency, this Greenkeeper branch strategy would fail, as it only allows updating the version of one dependency at a time.
Looking around, I found this Stack Overflow post that mentions manipulating the package-lock.json
:
However, this is not possible in my project because I have an .npmrc
with package-lock=false
and, as mentioned in this tool for automating the process, it’s a big hack that should be avoided anyways.
So, I guess it’s looking like if I had multiple dependencies that I needed to be updated in the can
package, my best bet would be to fork the can
repository and update those packages myself until a release of the can
package was made that met my requirements.
I’m not sure if there is a better workflow, but it is something worth documenting, as dependency management within the plethora of interrelated modules in the Bitovi frameworks has probably been the biggest time-sink and non-starter for me when getting a project off the ground. I’m always having to manually patch things and cherry pick pull requests that have not been merged for months.
If you’re new, the sheer number of packages can be overwhelming in addition to the volume of unresolved issues and PRs that are often times unintelligible to a newbie outsider. It seems there are many new concepts being introduced with incremental rendering and dynamic component creation, and eventually things will settle down. However, I feel the huge number of un-merged Greenkeeper PRs for example make it hard for newcomers (or anyone, really) to wade through and find the active branches for instance.
In general, it would be nice if there was a push to have all packages updated so that deps are pinned to the latest versions across the board as a kind of fresh start, and to delete the mass of Greenkeeper branches in the repos to make the truth about dependencies more explicit and everything easier to navigate. Hopefully that is something that will come soon, in time.