oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.21k stars 2.77k forks source link

Bunx force update cache #12245

Open CodeFromAnywhere opened 4 months ago

CodeFromAnywhere commented 4 months ago

What is the problem this feature would solve?

Screenshot 2024-06-29 at 10 35 41

The screenshot says enough. It cached 0.0.3 or so, and because I called 0.0.7 when it didn't exist yet, it remembers that even if it later DOES exist

What is the feature you are proposing to solve the problem?

When I publish a new version of my package, I want it to not cache things.

I am proposing a --no-cache feature that would force re-fetching the package.

Furthermore, I think it wouldn't hurt to do this once in a while anyway. If I specify the version with @x.x.x and later I run it without @x.x.x, it will not take the latest version but the first one it installed.

What alternatives have you considered?

I couldn't find a way to fix this yet. Maybe I can clean the global cache of bun entirely?

For now, I've changed my version to 0.0.10, published, and used bunx with @0.0.10. Now it works.

paperdave commented 4 months ago

Maybe I can clean the global cache of bun entirely?

not cleanly documented however bun pm cache rm clears bunx caches in addition to bun install caches. we should make it possible to clean just the bunx cache, as well as a temporary no-cache flag.

rodhoward commented 1 month ago

I edited one of my node_modules packages directly adding a few console logs in there just to debug things. Then I was quite suprised to find it effecting all my projects with the same dependency.

rm -rf node_modules
bun install

Has no effect my changes are still there.. Which is explained by the hard link documentation so that makes sense! and its kinda cool. But now I have a dirty cached package how can I correctly clear this cache and re-fetch a fresh version of the package?

bun pm cache rm

Doesn't seem to help me.. I guess I could manually delete the ~/.bun/install/cache/ directory but that seems extream.