Better Dependency Management for NPM

By David V.

Apr 30, 2016

When you are like me working in a team of web engineers, on a project
which involves usage of external 3rd party libraries and you are using
npm and/or bower to manage those dependencies, you probably will find it

The problem

When you are working in a team and you are not keeping the 3rd party
dependencies as part of your repository. Someone decides to
add/remove/upgrade some dependency, they modify package.json or
bower.json files reflecting the change and submits the change into
repository.  Now you pull those changes into your local copy of the
project and unless you run manually npm install and bower install you
won’t have those dependencies updated for you locally. Which in most
cases result to build/run errors or inconsistency.

The solution

As we are working with grunt, I wrote a small grunt task which helps
detect and update dependencies if package.json or bower.json files
version was changed.  So from now on, when someone changes a dependency and bumps npm/bower version, grunt task will automatically update every team member local dependencies, which eliminates notifications, questions and increases productivity.  🙂

Feel free to use it:

Leave a Reply