-
-
Couldn't load subscription status.
- Fork 24
Allow the CACHE_DIR environment variable to override the cache location
#18
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
Conversation
Signed-off-by: Richie Bendall <[email protected]>
|
Did you see my comment: #10 (comment) ? |
Can you be more specific about the use-case? |
|
@langri-sha Can you reference the packages you were talking about in #16 (comment)? |
|
In my project I have 8 dependencies that use To save ~30s per build (~23$/mo), I have a local Feel free to use this if the PR doesn't get merged. |
|
I wish to correct myself on the point of |
|
|
CACHE_DIR environmental variable to override the cache location
Co-Authored-By: Sindre Sorhus <[email protected]>
…der inside of temp directory and update tests Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
|
@sindresorhus Ready for re-review! |
|
The code looks technically correct, but I feel like it could be refactored a bit to improve readability. https://github.com/Richienb/find-cache-dir/blob/ea4a195f23faee1f150e7342dd136aefdb603c54/index.js#L20 is kinda awkward, if true, the directory is the actual cache directory, if false, it's the CWD directory. This could be made a separate method: https://github.com/Richienb/find-cache-dir/blob/ea4a195f23faee1f150e7342dd136aefdb603c54/index.js#L32-L40 which could also include this part: https://github.com/avajs/find-cache-dir/blob/8ec64dcb35b3975e13a08dba2a3b6e7fb599ae30/index.js#L19-L25 That way the main method logic only handles the resolved cache directories. |
Co-Authored-By: Sindre Sorhus <[email protected]>
Co-Authored-By: Sindre Sorhus <[email protected]>
Co-Authored-By: Sindre Sorhus <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
|
I think it could still be made more readable. And this is not resolved:
|
Signed-off-by: Richie Bendall <[email protected]>
|
@sindresorhus I found a refactoring strategy to make the code more readable. |
CACHE_DIR environmental variable to override the cache locationCACHE_DIR environment variable to override the cache location
|
Looks good :) |
When the environmental variable
CACHE_DIRis specified, the specified directory will be used instead. This is useful in development situations where packages write useful information to the cache.Closes #16