shell-host/lang/node/npm

58 lines
2.5 KiB
Bash

#!/bin/bash
if command -v npm >/dev/null 2>&1; then
# echo addding node langauge stuff
# gives access to packages with bin in a project
path_append ./node_modules/.bin
export NPM_REGISTRY=https://npm.kebler.net
alias nr="npm run"
alias nrs="npm -s run"
alias nt="npm -s test"
alias ntw="npm -s run testw"
alias npms="npm start"
alias npmlag="npm la --silent --depth=0 --global"
alias npmla="npm la --silent --depth=0"
alias npmlaf="npm la --silent | grep"
alias npmlsf="npm ls --silent grep"
alias npmlsa="npm ls --silent"
alias npmls="npm ls --silent --depth=0"
# just npm install for install without saving into package.json
alias npmi="npm install --save"
alias npmr="npm uninstall --save"
alias npmio="npm install --save-optional"
alias npmro="npm uninstall --save-optional"
alias npmidv="npm install --save-dev"
alias npmidvnd="npm install --save-dev --package-lock-only --no-package-lock"
alias npmrdv="npm uninstall --save-dev"
# global for nodejs apps, will be alt directory if npmrc prefix is set
alias npmlsg="npm ls --silent --depth=0 --global"
alias npmig="npm install -g"
alias npmrg="npm uninstall -g"
# global forced in sudo system location /usr
alias snpmig="sudo npm install -g --prefix /usr"
alias snpmlsg="sudo npm ls --silent --depth=0 --global --prefix /usr"
alias snpmrg="sudo npm uninstall -g --prefix /usr"
alias npmunpm="echo npm installed version && npm --version && echo npm latest version available && npm view npm@latest version && echo any key to continue npm upgrade or break && read && sudo npm install -g npm@latest"
alias npmua="npm --depth=9999 update"
alias npmug="npm update -g"
alias npmu="npm-check -u"
alias npmcc="ncu -p -a -u"
alias npmcdvc="ncu -d -a -u"
alias npmc="ncu -p"
alias npma="npm-add-dependencies"
# will publish to whichever is the default registry - confusing so commented out
# alias npmpub="npm publish --access public"
alias npmlrepub="npm publish --registry http://localhost:4873 --force --access restricted"
alias npmlpub="npm publish --registry http://localhost:4873 --access restricted"
alias npmkrepub="npm publish --registry https://npm.kebler.net --force --access restricted"
alias npmkpub="npm publish --registry https://npm.kebler.net --access restricted"
alias npmpatch="npm version patch"
alias npmmajor="npm version major"
alias npmminor="npm version minor"
alias npmjspub="npm publish --registry https://registry.npmjs.org --access public"
alias yalcpush="nodemon -x 'yalc push'"
# else
# echo "node not installed, npm aliases not loaded"
fi