Skip to content

fix(clean): use find to recursively remove dist and node_modules#4641

Open
nnabeyang wants to merge 2 commits intobluesky-social:mainfrom
nnabeyang:fix/make-clean-remove-dist-and-node-modules
Open

fix(clean): use find to recursively remove dist and node_modules#4641
nnabeyang wants to merge 2 commits intobluesky-social:mainfrom
nnabeyang:fix/make-clean-remove-dist-and-node-modules

Conversation

@nnabeyang
Copy link
Contributor

Summary

This PR fixes the behavior of the make clean target in the Makefile.
Previously, make clean used:

rm -rf **/dist **/node_packages

However:

  • The pattern did not consistently match nested dist and node_modules directories across environments and shells (e.g., shells without globstar enabled).
  • There is no directory named node_packages in this repository — the intended directory is node_modules. A quick find . -type d -name "node_packages" returned no results.

As a result, make clean did not remove many of the expected build artifacts as intended.

What Changed

  • Replaced the glob-based removal with a find command that reliably locates all matching directories and deletes them:
find . -type d \( -name "dist" -o -name "node_modules" \) -prune -exec rm -rf {} +
  • Verified with find that the expected directories (dist and node_modules, including nested ones) are identified before deletion.

Why This Matters

  • The glob pattern previously used depends on shell configuration (e.g., globstar) and may silently fail in some environments.
  • The earlier pattern also referenced a non-existent directory (node_packages), meaning some intended removals were never happening.
  • The new implementation works consistently across shells and ensures that all intended dist and node_modules dirs are cleaned.

Verification

Before applying the change, the set of directories reported by:

find . -type d \( -name "dist" -o -name "node_modules" \) -prune -print

matched expectations in workspace layouts with nested packages. After removal, those directories are indeed deleted.

Additionally, running:

find . -type d -name "node_packages"

returned no results, confirming that the previous pattern was referring to a non-existent directory.

Impact

This only affects the make clean target: no other build behavior or code functionality is affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant