Add this to your .bashrc
...
This updates the spike call in a couple ways:
- if
spike
is found in thenode_modules
directory of thepwd
, it will use that "local" version of spike rather than the global version - adds
spike clean all
to remove_cache
when that directory is present inpwd
# make your node_modules first class
spike() {
local cmd
# find command path
if [[ -x ./node_modules/.bin/spike ]]; then
cmd="./node_modules/.bin/spike"
else
cmd="spike"
fi
# additional operations dependent on param
if [[ "$1" == "clean" ]]; then
if [[ "$2" == "all" ]] && [[ -d ./_cache ]]; then
rm -r _cache
echo -e "\033[0;32m✓ cleaned cache\033[m "
fi
$cmd "clean"
else
$cmd "$@"
fi
return
}