find-cache-dir
Advanced tools
Comparing version 3.3.0 to 3.3.1
@@ -8,2 +8,4 @@ 'use strict'; | ||
const {env, cwd} = process; | ||
const isWritable = path => { | ||
@@ -44,7 +46,7 @@ try { | ||
module.exports = (options = {}) => { | ||
if (process.env.CACHE_DIR) { | ||
return useDirectory(path.join(process.env.CACHE_DIR, 'find-cache-dir'), options); | ||
if (env.CACHE_DIR && !['true', 'false', '1', '0'].includes(env.CACHE_DIR)) { | ||
return useDirectory(path.join(env.CACHE_DIR, 'find-cache-dir'), options); | ||
} | ||
let {cwd: directory = process.cwd()} = options; | ||
let {cwd: directory = cwd()} = options; | ||
@@ -51,0 +53,0 @@ if (options.files) { |
{ | ||
"name": "find-cache-dir", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"description": "Finds the common standard cache directory", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -45,3 +45,3 @@ # find-cache-dir [![Build Status](https://travis-ci.org/avajs/find-cache-dir.svg?branch=master)](https://travis-ci.org/avajs/find-cache-dir) [![Coverage Status](https://coveralls.io/repos/github/avajs/find-cache-dir/badge.svg?branch=master)](https://coveralls.io/github/avajs/find-cache-dir?branch=master) | ||
Finds the cache directory using the supplied options. The algorithm checks for the `CACHE_DIR` environmental variable, and if one is not found, it tries to find a `package.json` file, searching every parent directory of the `cwd` specified (or implied from other options). It returns a `string` containing the absolute path to the cache directory, or `undefined` if `package.json` was never found or if the `node_modules` directory is unwritable. | ||
Finds the cache directory using the supplied options. The algorithm checks for the `CACHE_DIR` environmental variable and uses it if it is not set to `true`, `false`, `1` or `0`. If one is not found, it tries to find a `package.json` file, searching every parent directory of the `cwd` specified (or implied from other options). It returns a `string` containing the absolute path to the cache directory, or `undefined` if `package.json` was never found or if the `node_modules` directory is unwritable. | ||
@@ -48,0 +48,0 @@ #### options |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
6959
52
1