New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adhere to XDG Base Desktop Specification #2574
Comments
I don't have objections. If we do this, we should do this now. Before pnpm v5 is out cc @pnpm/collaborators |
This would break existing workflows. My CIs cache
You can use pnpm install --store-dir $XDG_DATA_HOME/.pnpm-store |
Or through the |
There are many competing standards, like |
They are not compete. They are part of XDG standard. https://wiki.archlinux.org/index.php/XDG_Base_Directory#User_directories That is pnpm store should be in |
I don't consider |
ok, so should we have this logic? if
|
Implementing this would do more harm than good in my opinion. |
ok, I will keep it open for further discussion but won't do it in scope of v5. |
thanks for mentioning the if it's decided to go with this, i think resolution should look something like this to preserve backwards compatibility
|
This would dramatically increase complexity, not for the main code, but for the tests. Prove that this feature worth it. |
There are a few other issues I've found while trying to massage pnpm into XDG-compliance:
As for why pnpm should bother with any of this: the virtues of the XDG base directory spec are not specific to pnpm, and you can find lots of words spilled in lots of other places about why it's worth it. In short: it declutters, it enables version control of configuration, it enables different backup strategies for caches versus other local data, it enables these locations to be moved to other filesystems in unusual circumstances without fiddling with each program's configuration individually, and probably a few other common advantages that don't come immediately to mind. Separating out cache from configuration from other local user-specific files is just a user-friendly move in general, because it gives the user more power to manage those things appropriately. And having standard but configurable locations for those three types of data just makes sense so that said management can be applied across many applications. |
Here is the corresponding issue for Yarn: yarnpkg/yarn#2334 I've noticed many projects follow this pattern:
While we wait for for step 4 to run it's course, I recommend (plead 🙏🏻 ) swapping out all the hard-coded |
+1 for this |
I am OK changing this in the next major version. As of now
I think we can move the The pnpm store currently contains also the cache of package metadata files. These files can be safely removed, so they should be stored separatly from the content-addressable store. The content-addressable store should be in According to this standard, is it fine to install the actual pnpm source files at Edit: probably moving the metadata cache to $XDG_CACHE_HOME is not a breaking change as well. |
The new changes sound fantastic, on the assumption that files will have a parent directory of
The way I interpret the standard, it seems the the pnpm source files should be installed to some directory in |
I agree with @eankeen, It would be much better to store data in E.g. Instead of Or you can give user option to set custom paths like we already have with https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html |
Is it OK to use the XDG standard on macOS as well? |
I don't use macOS anymore, so I don't have direct experience, but I will say that it's definitely OK in my view. Adhering to the standard solves the same problems as on Linux, and will match the behavior of many programs ran on macOS - ex. saving configuration to |
XDG specifications were designed to be used in Linux, but fit other systems as well. Here is a rust lib trying to do this in bast possible way. It boils down to this:
So, for MacOS config files should never be saved in
Of course this increases complexity. It is up to maintainer if making this change non-breaking is worth the effort. Project mentioned above and this point paths that should be used as last fallback. If maintaining the code used to lookup old locations is too much, it could be retired after a transition period. This issue is really common. It always goes just like @razor-x described. Users are tired. Please don't end up like bash, minecraft or ssh. |
Seems like @folder/xdg may be used to get defaults for different operating systems. Does it make sense to install pnpm into |
@zkochan Looking into my Application Support folder it seems most apps use it for storage, caches, logs, databases, settings, user data, etc. Don't know how it is for apps that adhere to XDG, but generally it would seem weird to install something there. But if anyone knows macOS internals better I would go with their advice. |
@umireon suggested the app support folder |
I did some quick searching (by no means a thorough search). I have found that this project uses And I found this Stack Overflow discussion where the most upvoted answer recommends To me it seems that implementing XDG requires a bit of research if we want to properly implement it. Maybe it can be done in parts? If it's easier to implement for Linux, we could only focus on that for now? |
@nikoladev Really insightful.
I as a Homebrew contributor need this on macOS very soon. https://developer.apple.com/library/archive/qa/qa1170/_index.html
I change the suggestion: I suggest |
ok, let's do |
IntelliJ/WebStorm seems to need to manually add support to the new pnpm home dir: https://youtrack.jetbrains.com/issue/IDEA-276673 |
Moving the config to XDG_CONFIG_HOME: #3873 |
One last thing that wasn't changed is the location of the global store. Should we change it to There was some concern regarding this:
We can change the location of the global store in pnpm v7 #4522 |
Noticed the location was going to change in v7, which is great. Never liked I've always used |
haii,
i was wondering if there is any interest to adhere to the xdg base desktop specification, even if it's just a little bit? right now i see a
~/.pnpm-store
file created in the home directory. better adherence would mean checking for the variable$XDG_DATA_HOME
, and creating the file at$XDG_DATA_HOME/pnpm-store
. if $XDG_DATA_HOME is not set, then the file should be created at~/.local/share/pnpm-store
. if this is a bit too much to ask, can we set a variable like$PNPM_STORE_PATH
to manually set the path? (i like my home directory, and would very much like to change the location). i read the docs and couldn't seem to find any more detail about how pnpm handles creating the.pnpm-store
file. more info on the xdg base directory specification can be found herethankies,
edwin
The text was updated successfully, but these errors were encountered: