Skip to content

Instantly share code, notes, and snippets.

@danielschwartz85
Last active June 27, 2023 22:13
Show Gist options
  • Save danielschwartz85/7f85c6a85dbec4d6edaf7b6b854f1433 to your computer and use it in GitHub Desktop.
Save danielschwartz85/7f85c6a85dbec4d6edaf7b6b854f1433 to your computer and use it in GitHub Desktop.
view an npm package.json

Bash script for viewing an npm package package.json

Usgae

  npmv eslint@14.2.0
  npmv eslint
  npmv @koa/router@14.2.3
#!/bin/bash

URL=`npm v $1 | grep .tarball | awk -F \.tarball:\  {' print $2 '}`
PACKAGE=`echo $URL | awk -F \/-\/ {' print $2 '}`
wget $URL &> /dev/null
tar -zxf $PACKAGE package/package.json 
cat package/package.json

rm -rf cat package/
rm -rf $PACKAGE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment