diff --git a/.bash_aliases/all b/.bash_aliases/all index deaa29c..f967326 100644 --- a/.bash_aliases/all +++ b/.bash_aliases/all @@ -11,6 +11,7 @@ alias eal="nvim ~/.bash_aliasrc" alias ev="edit_editor_config" # Navigation + alias ..="cd .." alias .2="cd ../.." alias .3="cd ../../.." @@ -72,3 +73,33 @@ alias r="R" alias azerty="setxkbmap be" alias qwerty="setxkbmap us" alias cole="setxkbmap us -variant colemak" + +yarn() { + if [[ -f "package-lock.json" ]]; then + echo "WARNING: package-lock.json exists" + read -p "Are you sure you want to run yarn? [y/N] " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + command yarn "$@" + else + echo "Aborted" + fi + else + command yarn "$@" + fi +} + +npm() { + if [[ -f "yarn.lock" ]]; then + echo "WARNING: yarn.lock exists" + read -p "Are you sure you want to run npm? [y/N] " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + command npm "$@" + else + echo "Aborted" + fi + else + command npm "$@" + fi +}