Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add XDG support for the cache dir #696

Closed
RaafatTurki opened this issue Jul 14, 2022 · 1 comment
Closed

Add XDG support for the cache dir #696

RaafatTurki opened this issue Jul 14, 2022 · 1 comment
Labels
bun install Something that relates to the npm-compatible client enhancement New feature or request

Comments

@RaafatTurki
Copy link

RaafatTurki commented Jul 14, 2022

What is the problem this feature will solve?

the XDG spec is already implemented pretty nicely in this project, however I've noticed the cache dir ~/.bun/install/cache/ was neglected in that regard (I think it can be configure but having it work out of the box is better).

adding XDG support to the cache dir is a good idea because:

  • makes wiping cache easier (deleting the cache dir will delete buns cache excluding its configs)
  • unclutters the $HOME directory

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

Implementing this is pretty simple, instead of writing cache files into ~/.bun/install/cache/ a simple series of checks is performed to pick the right path with backward compatibility in mind ofc:

  • if ~/.bun/ exists use it
  • else if environment variable XDG_CACHE_HOME is set use $XDG_CACHE_HOME/bun/
  • else use XDG_CACHE_HOMEs default value which is ~/.cache/bun/

If this gets implemented:

  • Current users can move their ~/.bun/install/cache to XDG_CACHE_HOME (default is ~/.cache)
  • New users will have to do nothing and it will just work as it should

What alternatives have you considered?

I don't think there is, Most of unix software supports this for a reason, I think bun should definitely have it.

@RaafatTurki RaafatTurki added the enhancement New feature or request label Jul 14, 2022
lgarron added a commit to lgarron/bun that referenced this issue Oct 19, 2022
This partially addresses oven-sh#696 , by using `$XDG_CACHE_HOME` for those of us who already have that env var set.
lgarron added a commit to lgarron/bun that referenced this issue Oct 19, 2022
…ME`.

This partially addresses oven-sh#696 , by using `$XDG_CACHE_HOME` for those of us who already have that env var set.
Jarred-Sumner pushed a commit that referenced this issue Oct 19, 2022
…ME`. (#1351)

This partially addresses #696 , by using `$XDG_CACHE_HOME` for those of us who already have that env var set.
@Electroid Electroid added the bun install Something that relates to the npm-compatible client label Nov 2, 2022
@Electroid
Copy link
Contributor

Duplicate of #1678

@Electroid Electroid marked this as a duplicate of #1678 Oct 24, 2023
@Electroid Electroid closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bun install Something that relates to the npm-compatible client enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants