This repository has been archived on 2022-02-20. You can view files and clone it, but cannot push or open issues/pull-requests.
bash-shell-host/all/modules/node.sh

16 lines
427 B
Bash
Raw Permalink Normal View History

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 $@