npm.plugin.zsh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. (( $+commands[npm] )) && {
  2. rm -f "${ZSH_CACHE_DIR:-$ZSH/cache}/npm_completion"
  3. _npm_completion() {
  4. local si=$IFS
  5. compadd -- $(COMP_CWORD=$((CURRENT-1)) \
  6. COMP_LINE=$BUFFER \
  7. COMP_POINT=0 \
  8. npm completion -- "${words[@]}" \
  9. 2>/dev/null)
  10. IFS=$si
  11. }
  12. compdef _npm_completion npm
  13. }
  14. # Install dependencies globally
  15. alias npmg="npm i -g "
  16. # npm package names are lowercase
  17. # Thus, we've used camelCase for the following aliases:
  18. # Install and save to dependencies in your package.json
  19. # npms is used by https://www.npmjs.com/package/npms
  20. alias npmS="npm i -S "
  21. # Install and save to dev-dependencies in your package.json
  22. # npmd is used by https://github.com/dominictarr/npmd
  23. alias npmD="npm i -D "
  24. # Execute command from node_modules folder based on current directory
  25. # i.e npmE gulp
  26. alias npmE='PATH="$(npm bin)":"$PATH"'
  27. # Check which npm modules are outdated
  28. alias npmO="npm outdated"
  29. # Check package versions
  30. alias npmV="npm -v"
  31. # List packages
  32. alias npmL="npm list"
  33. # List top-level installed packages
  34. alias npmL0="npm ls --depth=0"
  35. # Run npm start
  36. alias npmst="npm start"
  37. # Run npm test
  38. alias npmt="npm test"
  39. # Run npm scripts
  40. alias npmR="npm run"
  41. # Run npm publish
  42. alias npmP="npm publish"
  43. # Run npm init
  44. alias npmI="npm init"