Created
September 16, 2012 22:30
-
-
Save twolfson/3734644 to your computer and use it in GitHub Desktop.
package.json version pre-commit incrementer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# An example hook script to verify what is about to be committed. | |
# Called by "git commit" with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# it wants to stop the commit. | |
# | |
# To enable this hook, rename this file to "pre-commit". | |
node -e "var f = './package.json', p = require(f), v = p.version || '0.0.0', a = v.split('.'), b; a[2] = +a[2] + 1; p.version = a.join('.'); require('fs').writeFileSync(f, JSON.stringify(p, null, 2));" | |
git add ./package.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment