Skip to content

feat(dlx): cache#7835

Merged
zkochan merged 89 commits intomainfrom
pnpx-redownload-reinstall-every-time-5277
Apr 9, 2024
Merged

feat(dlx): cache#7835
zkochan merged 89 commits intomainfrom
pnpx-redownload-reinstall-every-time-5277

Conversation

@KSXGitHub
Copy link
Copy Markdown
Contributor

@KSXGitHub KSXGitHub commented Mar 27, 2024

Fixes #5277


TODO:

  • Group the cache directories by id.
  • Fix tests in dlx.e2e.ts and run.ts.
  • Fix cleanExpiredCache.ts.
  • Fix cleanExpiredCache.test.ts.
  • Refactor: Rename cleanExpiredCache to cleanExpiredDlxCache.
  • Fix tests for storePrune.ts.
  • Proper tests for pruning dlx cache must be placed in run.ts (as a CLI invoker).
  • Test removing orphans.
  • Test running dlx with cache that is expired but still exist.
  • Test running multiple dlx in parallel with cache that is expired but still exist.
  • Refactor dlx.ts: async fs methods.

@KSXGitHub KSXGitHub force-pushed the pnpx-redownload-reinstall-every-time-5277 branch from ccff5c2 to ffefa7e Compare March 27, 2024 16:36
@KSXGitHub KSXGitHub force-pushed the pnpx-redownload-reinstall-every-time-5277 branch from e63f9af to 5abba52 Compare March 28, 2024 05:39
@KSXGitHub KSXGitHub force-pushed the pnpx-redownload-reinstall-every-time-5277 branch from 5abba52 to bb3a336 Compare March 28, 2024 08:22
@KSXGitHub KSXGitHub marked this pull request as ready for review April 4, 2024 15:12
@KSXGitHub KSXGitHub force-pushed the pnpx-redownload-reinstall-every-time-5277 branch 2 times, most recently from 07535d5 to d1fb986 Compare April 4, 2024 19:23
Copy link
Copy Markdown
Member

@zkochan zkochan left a comment

Choose a reason for hiding this comment

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

I think overall it looks fine. I will spend more time reviewing it later because it is a lot of changes. However, I think the approach is fine.

}
}
try {
await fs.symlink(newPrefix, cacheLink, 'junction')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use the symlink-dir library. It is already used in many places for creating symlinks on POSIX and junctions on Windows.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@KSXGitHub KSXGitHub requested a review from zkochan April 5, 2024 07:44
@zkochan
Copy link
Copy Markdown
Member

zkochan commented Apr 5, 2024

tests fail after your change

@KSXGitHub KSXGitHub force-pushed the pnpx-redownload-reinstall-every-time-5277 branch from 3c9a3db to 91e2685 Compare April 5, 2024 19:00
@zkochan
Copy link
Copy Markdown
Member

zkochan commented Apr 7, 2024

The test fails on Windows with Node.js 21 due to some issue released in node.js v21.5.0. This might fix the issue as it seems to happen only when the path is long: nodejs/node#51097

@zkochan zkochan merged commit 98566d9 into main Apr 9, 2024
@zkochan zkochan deleted the pnpx-redownload-reinstall-every-time-5277 branch April 9, 2024 01:30
"@pnpm/plugin-commands-store": patch
---

Added cache for `pnpm dlx` [#5277](https://github.com/pnpm/pnpm/issues/5277).
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.

Where is it cached and for how long?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

5 minutes by default. Add dlx-cache-max-age=N to .npmrc to set it to N minutes.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No, I changed it to 1 day.

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.

PNPX re-downloads/installs every time

3 participants