shared-store
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -0,1 +1,7 @@ | ||
### 2.1.4 | ||
* Gracefully handle missing dir - **[@jkrems](https://github.com/jkrems)** [#33](https://github.com/groupon/shared-store/pull/33) | ||
- [`571d011`](https://github.com/groupon/shared-store/commit/571d011cbcd00d0065d4034ed023d7301cccc090) **fix:** Gracefully handle missing dir | ||
### 2.1.3 | ||
@@ -2,0 +8,0 @@ |
@@ -34,3 +34,3 @@ | ||
'use strict'; | ||
var Bluebird, CSON, debug, dirChanges, fileChanges, fileContent, fromPromiseFunction, fs, identity, isMissingError, onInterval, parseCSON, parseJSON, parserFromExtension, partial, path, promisify, readFile, ref; | ||
var Bluebird, CSON, debug, dirChanges, fileChanges, fileContent, fromPromiseFunction, fs, identity, isMissingError, onInterval, parseCSON, parseJSON, parserFromExtension, partial, path, promisify, readFile, ref, surroundingDirExists; | ||
@@ -102,2 +102,16 @@ fs = require('fs'); | ||
surroundingDirExists = function(filename) { | ||
var dirStat, err; | ||
try { | ||
dirStat = fs.statSync(path.dirname(filename)); | ||
return dirStat.isDirectory(); | ||
} catch (error1) { | ||
err = error1; | ||
if (err.code !== 'ENOENT') { | ||
throw err; | ||
} | ||
return false; | ||
} | ||
}; | ||
fileContent = function(filename, options) { | ||
@@ -138,3 +152,3 @@ var defaultValue, hasDefault, interval, load, loaded, parse, returnDefault, rootDir, watch, wrap; | ||
}); | ||
if (watch) { | ||
if (watch && surroundingDirExists(filename)) { | ||
return load().concat(fileChanges(filename).flatMap(load)); | ||
@@ -141,0 +155,0 @@ } else { |
{ | ||
"name": "shared-store", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "Keeping config data in sync", | ||
@@ -5,0 +5,0 @@ "license": "BSD-3-Clause", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56184
1046