Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -all option to 'yarn clean' #2176

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion utils/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,30 @@ MYPATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# ROOT is the root directory of our project.
ROOT="$MYPATH/.."

pushd "$ROOT"
pushd "$ROOT" >/dev/null 2>&1

CLEAN_ALL=false
while [[ $# -gt 0 ]]; do
case $1 in
-a|--all)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably make an argument for not having an option at all and just deleting all node_modules folder always.

What say you?

CLEAN_ALL=true
shift # past argument
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done

rm -rf packages/*/dist
rm -rf .nyc_output/
rm -rf coverage/
rm -rf cypress/
rm -rf packages/*/*.tsbuildinfo
rm -rf storybook-static/

if [[ "$CLEAN_ALL" == "true" ]]; then
echo "Removing node_modules directories. You'll need to 'yarn install' after this."
find . -name node_modules -and -type d -prune -exec rm -rf '{}' \;
fi