fix(store): return only directory names when clean expired cache#10384
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where pnpm store prune would fail when encountering non-directory files (like macOS .DS_Store files) in the cache directory. The fix ensures that only directories are processed when cleaning the expired DLX cache.
Key Changes:
- Modified
readOptDirto filter out files and return only directory names - Changed
readdirSyncto usewithFileTypes: trueoption for more efficient type checking
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zkochan
approved these changes
Dec 30, 2025
|
Congrats on merging your first pull request! 🎉🎉🎉 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I ran into this error when executing
pnpm store prune. After looking into the relevant code, I found that the command does not filter out files when traversing directories, which causes macOS Finder cache files like.DS_Storeto unexpectedly break the command.I understand that users normally wouldn't access this directory, so
.DS_Storeusually wouldn't be present. Still, I think it's important to add logic to ensure that filesystem traversal only considers directories, to improve the robustness of the code.This is a small and straightforward fix. Thanks in advance, and looking forward to your review.