sindresorhus / guides

A collection of succinct guides - Public Domain
2.47k stars 458 forks source link

use xdg data path for packages, avoid doubled paths and uset unused var #56

Closed Konfekt closed 4 years ago

sindresorhus commented 4 years ago

I feel like you've made the guide over-complicated for very little practical gain. I'm honestly not sure if I want to merge this.

Konfekt commented 4 years ago

I feel like you've made the guide over-complicated for very little practical gain. I'm honestly not sure if I want to merge this.

Good point. Complexity arises by taking care of rare edge cases. For example,

export PATH="${PATH:+"${PATH}:"}${NPM_PACKAGES}/bin"

ensures that $PATH is correctly set, even if empty. Likewise for all other environment variables.

This snippet

if ! [ -d "$NPM_PACKAGES" ]; then
    npm config set prefix "$NPM_PACKAGES"
    npm config set cache "${XDG_CACHE_HOME:-"$HOME"}/.npm"
fi

is convenient if you ever move your dotfiles over to a different computer; in case you forget to configure npm accordingly there again.

What do you deem useful and what dispensable? In any event, this pull request was meant for people that are fine with pasting a longer snippet in compensation for more convenience down the road. Just to give them the option.

Slayug commented 4 years ago

I feel like you've made the guide over-complicated for very little practical gain. I'm honestly not sure if I want to merge this.

In any event, this pull request was meant for people that are fine with pasting a longer snippet in compensation for more convenience down the road.

It's complicated for us, but easier for final user, copy paste. I agree with both, shall we keep the old version and create a new section just to support the XDG way ? Is it worth it actually to support XDG path ?

Konfekt commented 4 years ago

Is it worth it actually to support XDG path ?

Functionally no difference. It is just neat, like the whole XDG specification is. Useful to keep track of the settings and folders of your installed programs.

sindresorhus commented 4 years ago

I've decided to pass on this. I don't think it's worth the complexity. However, I'm willing to link to your fork if you can commit to maintaining it. If so, do another PR with a link to your fork instead.