Do you want to request a feature or report a bug?
Feature
What is the current behavior?
Cache location can only be configured via the cache-folder config option.
What is the expected behavior?
Being able to configure the cache location using an environment variable.
Other prominent package managers offer this functionality:
COMPOSER_CACHE_DIRNPM_CONFIG_CACHEGEM_SPEC_CACHEbower_storage__packages (unconfirmed)PIP_DOWNLOAD_CACHE (unconfirmed)This is extremely useful for continuous integration - you may want jobs to use a shared cache, but each individual job may not know (or perhaps shouldn't know) where that global cache exists. Additionally, if that global cache directory changes, it's much easier to update a single environment variable in the CI system than updating the yarn commands in every individual project.
I therefore propose using an envvar like YARN_CONFIG_CACHE_FOLDER. If defined, this would take precedence over the default cache directory. (However, it would not take precedence over any cache-folder option used on the command line.)
Sounds like a good first bug @colinodell
Can I take take a look and try to send in a PR?
Yeah absolutely!
This feature already seems to exist. The env variable name is YARN_CACHE_FOLDER
$ YARN_CACHE_FOLDER="foo" ./bin/yarn cache dir
foo/v1
Yes, actually Yarn converts all environment variables into
YarnRegistry.config if they have yarn_ prefix.
That is not a widely known fact, do you want to write start a doc on the website for that, @zurawiki ?
@bestander never link to branches! now, what line you had in mind?
馃毀 Never link to branches, share a permalink 馃毀
Most helpful comment
Yes, actually Yarn converts all environment variables into
YarnRegistry.config if they have
yarn_prefix.That is not a widely known fact, do you want to write start a doc on the website for that, @zurawiki ?