Last active
August 29, 2015 14:02
-
-
Save joates/1183b8f3a909804af8d2 to your computer and use it in GitHub Desktop.
[bash] extracts version info from package.json ( \1= Major \2=Minor \3=Patch )
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
| # example usage | |
| # ------------- | |
| # "version": "1.2.3-beta" | |
| # | |
| # value captured by `sed -e` | |
| # -------------------------- | |
| # | |
| # \1 = 1 (major) | |
| # \2 = 2 (minor) | |
| # \3 = 3-beta (patch) | |
| node -e 'console.log(require("./package.json").version)' |sed -e 's/^\([0-9]\+\)\.\([0-9]\+\)\.\([a-zA-Z0-9-]\+\)$/\3/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment