Skip to content
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

Follow XDG Specification #145

Closed
shubham-cpp opened this issue Jul 13, 2022 · 6 comments · Fixed by #152
Closed

Follow XDG Specification #145

shubham-cpp opened this issue Jul 13, 2022 · 6 comments · Fixed by #152

Comments

@shubham-cpp
Copy link

XDG Base Directory

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

@ljharb
Copy link
Member

ljharb commented Jul 13, 2022

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.

@shubham-cpp
Copy link
Author

shubham-cpp commented Jul 13, 2022

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)

@aduh95
Copy link
Contributor

aduh95 commented Jul 14, 2022

Is it something you'd like to open a PR for?

@shubham-cpp
Copy link
Author

Need to look into this

@Mitsunee
Copy link

Mitsunee commented Jul 23, 2022

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 ( npm/cacache#119 ) and it'd be great if corepack could also use the $XDG_DATA_HOME variable if available.

arcanis pushed a commit that referenced this issue Aug 15, 2022
* feat: do not use `~/.node` as default value for `COREPACK_HOME`

Fixes: #145
Refs: nodejs/node#43859

* fixup! feat: do not use `~/.node` as default value for `COREPACK_HOME`

* Update sources/folderUtils.ts

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>

* Update README

* migrate old corepack home folder

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
@shubham-cpp
Copy link
Author

Big thank you to all the guys that worked on this.
Open source community at its best again.

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 a pull request may close this issue.

4 participants