Update semver dependency to 4.0
Only write to file if its version number has changed. Fixes #9.
0.3.1