corepack
corepack copied to clipboard
Follow XDG Specification
By default, corepack creates folder on $HOME/.node/corepack. This should not be the default, but rather a fallback.
Default location should be something like $XDG_CACHE_HOME/node/corepack or $HOME/.cache/node/corepack respecting the xdg specifications
Note that the XDG specification uses "should" liberally, and "must" only rarely, so there's very little the XDG specification actually requires things to do in order to be compliant.
Agreed, but since npm, pnpm and yarn,nvm, ect also provide options for xdg specs, then why not provide an option for corepack as well. People who might want to opt in to xdg specs can use that(like environment variable)
Is it something you'd like to open a PR for?
Need to look into this
came here to open this exact issue. I have XDG user dirs configured and
prefix=${XDG_DATA_HOME}/node
cache=${XDG_CACHE_HOME}/npm
init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js
in my npmrc (location configured via $NPM_CONFIG_USERCONFIG, which is fine) and now corepack and cacache are the two things ignoring this (yarn at least mostly follows XDG dirs) and constantly recreating the ~/.npm and ~/.node directories I'm trying to avoid having to a completely clean setup. I opened a ticket for cacache already ( https://github.com/npm/cacache/issues/119 ) and it'd be great if corepack could also use the $XDG_DATA_HOME variable if available.
Big thank you to all the guys that worked on this. Open source community at its best again.