Get package.json version from CLI

node -p -e "require('./package.json').version"

The -p argument prints the result and the -e argument expects executable JS to follow it.

Leave a Reply

Your email address will not be published. Required fields are marked *