Skip to content

Commit d6aa2dd

Browse files
authored
Merge pull request #661 from degouville/fix/bun-cache-proper-cleanup
fix(clean): use proper bun pm cache rm for Bun cache cleanup
2 parents beb9d4b + 611191c commit d6aa2dd

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lib/clean/dev.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,23 @@ clean_dev_npm() {
9191
safe_clean ~/.tnpm/_cacache/* "tnpm cache directory"
9292
safe_clean ~/.tnpm/_logs/* "tnpm logs"
9393
safe_clean ~/.yarn/cache/* "Yarn cache"
94-
safe_clean ~/.bun/install/cache/* "Bun cache"
94+
95+
# Bun cache - check if bun is installed and usable
96+
if command -v bun > /dev/null 2>&1 && bun --version > /dev/null 2>&1; then
97+
clean_tool_cache "bun cache" bun pm cache rm
98+
local bun_cache_path
99+
start_section_spinner "Checking bun cache path..."
100+
bun_cache_path=$(run_with_timeout 2 bun pm cache 2> /dev/null) || bun_cache_path=""
101+
stop_section_spinner
102+
# If custom cache path, also clean orphaned default location
103+
if [[ -n "$bun_cache_path" && "$bun_cache_path" != "$HOME/.bun/install/cache" ]]; then
104+
safe_clean ~/.bun/install/cache/* "Orphaned bun cache"
105+
fi
106+
else
107+
# bun not installed, just clean the default cache directory
108+
safe_clean ~/.bun/install/cache/* "bun cache"
109+
fi
110+
note_activity
95111
}
96112
# Python/pip ecosystem caches.
97113
clean_dev_python() {

0 commit comments

Comments
 (0)