-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use find + exec, also allow dir via argv1
- Loading branch information
souzaramon
committed
Mar 7, 2023
1 parent
70b91c3
commit e7afda7
Showing
1 changed file
with
3 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
#!/bin/bash | ||
#! /usr/bin/env sh | ||
set -e | ||
|
||
function delete_node_modules { | ||
for file in "$1"/*; do | ||
if [[ -d "$file" ]]; then | ||
if [[ "$file" == *"/node_modules" ]]; then | ||
echo "Deletando $file" | ||
rm -rf "$file" | ||
else | ||
delete_node_modules "$file" | ||
fi | ||
fi | ||
done | ||
} | ||
|
||
delete_node_modules "$(pwd)" | ||
find "${1-"$(pwd)"}" -name 'node_modules' -type d -prune -exec rm -rf '{}' + |