Skip to content

Instantly share code, notes, and snippets.

View ThePlenkov's full-sized avatar

Petr Plenkov ThePlenkov

View GitHub Profile
@ThePlenkov
ThePlenkov / get-npm-package-version
Last active April 10, 2021 00:29 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
# 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'
| awk '{$1=$1};1'
)
echo $PACKAGE_VERSION