Add this to your .bashrc...
This updates the spike call in a couple ways:
- if
spikeis found in thenode_modulesdirectory of thepwd, it will use that "local" version of spike rather than the global version - adds
spike clean allto remove_cachewhen 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
}