Skip to content

Instantly share code, notes, and snippets.

@halbgut
Created July 31, 2016 13:49
Show Gist options
  • Save halbgut/9bb78f4f81bac987b3aaf1087d6c986c to your computer and use it in GitHub Desktop.
Save halbgut/9bb78f4f81bac987b3aaf1087d6c986c to your computer and use it in GitHub Desktop.
A safer `npm install`
npmi () {
local packagename=$(echo ${@} | sed -E 's/(\-+[a-zA-Z0-9]+| )//g')
local opt
npm info ${packagename} | less
echo "Is it the right package? (y/n)"
read opt
if [[ "${opt}" == "y" ]]; then
npm i ${@}
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment