npm.plugin.zsh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. (( $+commands[npm] )) && {
  2. __NPM_COMPLETION_FILE="${ZSH_CACHE_DIR:-$ZSH/cache}/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. # List top-level installed packages
  30. alias npmL0="npm ls --depth=0"
  31. # Run npm start
  32. alias npmst="npm start"
  33. # Run npm test
  34. alias npmt="npm test"
  35. # Run npm scripts
  36. alias npmR="npm run"
  37. # Run npm publish
  38. alias npmP="npm publish"
  39. # Run npm init
  40. alias npmI="npm init"