Skip to content

Instantly share code, notes, and snippets.

Avatar

Pierre Dupuis 井磊 pidupuis

View GitHub Profile
@DarrenN
DarrenN / get-npm-package-version
Last active Oct 14, 2021 — forked from yvele/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
View get-npm-package-version
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION