npm.plugin.zsh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. (( $+commands[npm] )) && {
  2. __NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
  3. if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
  4. npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null
  5. [[ $? -ne 0 ]] && rm -f $__NPM_COMPLETION_FILE
  6. fi
  7. [[ -f $__NPM_COMPLETION_FILE ]] && source $__NPM_COMPLETION_FILE
  8. unset __NPM_COMPLETION_FILE
  9. }
  10. # Install dependencies globally
  11. alias npmg="npm i -g "
  12. # npm package names are lowercase
  13. # Thus, we've used camelCase for the following aliases:
  14. # Install and save to dependencies in your package.json
  15. # npms is used by https://www.npmjs.com/package/npms
  16. alias npmS="npm i -S "
  17. # Install and save to dev-dependencies in your package.json
  18. # npmd is used by https://github.com/dominictarr/npmd
  19. alias npmD="npm i -D "
  20. # Execute command from node_modules folder based on current directory
  21. # i.e npmE gulp
  22. alias npmE='PATH="$(npm bin)":"$PATH"'
  23. # Check which npm modules are outdated
  24. alias npmO="npm outdated"
  25. # Check package versions
  26. alias npmV="npm -v"
  27. # List packages
  28. alias npmL="npm list"
  29. # Run npm start
  30. alias npmst="npm start"
  31. # Run npm test
  32. alias npmt="npm test"