Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.

Commit

Permalink
Fixed: fallback to OS temp directory if findCacheDir fails (#154)
Browse files Browse the repository at this point in the history
* Fallback to os temp directory if findCacheDir fail

From the readme: `Finds the cache dir using the supplied options. The algorithm 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 null if package.json was never found.` This is a fallback for null condition. Investigated after @gaearon comments on facebook/create-react-app#1578 (comment)

* remove semicolon to align with overall code style

* Use double quotes instead of single quotes

To pass CI
  • Loading branch information
viankakrisna authored and MoOx committed Feb 22, 2017
1 parent 9e1025f commit 4fbffa0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Expand Up @@ -5,6 +5,7 @@ var crypto = require("crypto")
var fs = require("fs")
var findCacheDir = require("find-cache-dir")
var objectHash = require("object-hash")
var os = require("os")

var engines = {}
var cache = null
Expand Down Expand Up @@ -165,7 +166,7 @@ module.exports = function(input, map) {
thunk: true,
create: true,
})
cachePath = thunk("data.json")
cachePath = thunk("data.json") || os.tmpdir() + "/data.json"
try {
cache = require(cachePath)
}
Expand Down

0 comments on commit 4fbffa0

Please sign in to comment.