Skip to content

Commit

Permalink
Add -all option to 'yarn clean' (#2176)
Browse files Browse the repository at this point in the history
## Summary:

We've had instances where folks' local repo gets into a bad state. It's assumed that `yarn clean` will resolve this, but it hasn't in all cases because it doesn't delete `node_modules`.

This PR adds a `--all` option to `yarn clean` to demolish all `node_modules` folders in the local repo.

Issue: "none" 

## Test plan:

`yarn`
`yarn clean`
`ls node_modules` # still exists
`yarn clean --all`
`find . -name node_modules -and -type d` # no results!

Author: jeremywiebe

Reviewers: jeremywiebe, SonicScrewdriver, mark-fitzgerald, Myranae, catandthemachines

Required Reviewers:

Approved By: SonicScrewdriver

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x)

Pull Request URL: #2176
  • Loading branch information
jeremywiebe authored Jan 31, 2025
1 parent af8f5d3 commit 3be9d2c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion utils/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ 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

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

echo "Removing node_modules directories. You'll need to 'yarn install' after this."
find . -name node_modules -and -type d -prune -exec rm -rf '{}' \;

0 comments on commit 3be9d2c

Please sign in to comment.