greenkeeperio / greenkeeper-lockfile

:lock: Your lockfile, up to date, all the time
https://greenkeeper.io
183 stars 73 forks source link

fix: shrinkwrap commit fails if on dev dependency update #13

Closed leonardpunt closed 7 years ago

leonardpunt commented 7 years ago

Fixes issue https://github.com/greenkeeperio/greenkeeper-shrinkwrap/issues/12.

Problem: NodeJS's latest LTS Version (v6.10.3) includes npm 3.10.10. This version of npm doesn't lock down devDependencies in the shrinkwrap file by default:

Starting with npm v4.0.1, devDependencies are included when you run npm shrinkwrap and follow the usual rules as to when they're installed. https://docs.npmjs.com/cli/shrinkwrap#other-notes

Right now, if a devDependency is updated by greenkeeper, greenkeeper tries to update the shrinkwrap as well. However, because the devDependencies are not locked down in the shrinkwrap, there are no changes. Therefore the git commit fails, because git doesn't allow empty commits by default. Which causes the Travis build to break. Which results in greenkeeper filing an issue in the user's repository for every devDependency that needs an update.

The fix is to first check if there is anything to commit, before actually applying the commit.

boennemann commented 7 years ago

Hey @leonardpunt,

thanks a lot for this!

Best, Stephan