node -p 'JSON.parse(require("fs").readFileSync("pkg.json","utf8")).version'
Category: Node.js & npm/yarn
node -p 'JSON.parse(require("fs").readFileSync("pkg.json","utf8")).version'
Print the result of a JS expression — -p is like -e but auto-prints the return value
Like -e but also prints the return value. Useful for quickly extracting data in shell scripts.