shell-host/lang/node/node.lib

16 lines
438 B
Plaintext
Raw Normal View History

#!/bin/bash
module_load confirm
rm_node_modules () {
parent=${1:-$PWD}
echo finding node_modules folders within $parent
if command find . -name 'node_modules' -type d -prune 2>/dev/null;then
confirm continue with deleting? || return 1
command find . -name 'node_modules' -type d -prune -exec rm -r '{}' +
else
echo no folders to delete
fi
}
# if script was executed then call the function
(return 0 2>/dev/null) || rm_node_modules $@