Skip to content

fix(store): return only directory names when clean expired cache#10384

Merged
zkochan merged 3 commits into
pnpm:mainfrom
nshcr:fix-clean-cache-only-dirs
Dec 30, 2025
Merged

fix(store): return only directory names when clean expired cache#10384
zkochan merged 3 commits into
pnpm:mainfrom
nshcr:fix-clean-cache-only-dirs

Conversation

@nshcr

@nshcr nshcr commented Dec 30, 2025

Copy link
Copy Markdown
Contributor

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_Store to unexpectedly break the command.

I understand that users normally wouldn't access this directory, so .DS_Store usually 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.

Copilot AI review requested due to automatic review settings December 30, 2025 06:29
@nshcr nshcr requested a review from zkochan as a code owner December 30, 2025 06:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 readOptDir to filter out files and return only directory names
  • Changed readdirSync to use withFileTypes: true option for more efficient type checking

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread store/plugin-commands-store/src/cleanExpiredDlxCache.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 zkochan merged commit b773199 into pnpm:main Dec 30, 2025
17 checks passed
@welcome

welcome Bot commented Dec 30, 2025

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

zkochan added a commit that referenced this pull request Dec 30, 2025
)

* fix(store): return only directory names when clean expired cache

* docs: add changeset

* test: clean dlx cache

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
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.

3 participants