Extract JavaScript aliases to '~/.bash_aliases/js'
This commit is contained in:
35
.bash_aliases/lang-js
Normal file
35
.bash_aliases/lang-js
Normal file
@@ -0,0 +1,35 @@
|
||||
# shellcheck shell=bash
|
||||
# vim: set ft=bash :
|
||||
|
||||
alias js="node"
|
||||
alias ts="ts-node"
|
||||
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user