-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Respect name
option when CACHE_DIR
environment variable is set
#34
Conversation
@sindresorhus Whom shall I ask for a review? |
index.js
Outdated
@@ -43,7 +43,7 @@ function getNodeModuleDirectory(directory) { | |||
|
|||
module.exports = (options = {}) => { | |||
if (env.CACHE_DIR && !['true', 'false', '1', '0'].includes(env.CACHE_DIR)) { | |||
return useDirectory(path.join(env.CACHE_DIR, 'find-cache-dir'), options); | |||
return useDirectory(path.join(env.CACHE_DIR, options.name || 'find-cache-dir'), options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ||
is moot as the name
option is documented as "required".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return useDirectory(path.join(env.CACHE_DIR, options.name || 'find-cache-dir'), options); | |
return useDirectory(path.join(env.CACHE_DIR, options.name), options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why is was set to find-cache-dir
in the first place, appears to be an error that was never caught by the unit tests since the code was never tested under a different package name.
// @Richienb |
test.js
Outdated
delete process.env.CACHE_DIR; | ||
}); | ||
|
||
test('respects options.name when CACHE_DIR is set', t => { | ||
const newCacheDirectory = tempDirectory(); | ||
const finalDirectory = path.join(newCacheDirectory, 'babel-loader'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small nitpick: Might be best to use a more generic package name for posterity.
b350b3f
to
483b015
Compare
No description provided.