cosmiconfig
Advanced tools
Comparing version 3.0.0 to 3.0.1
# Changelog | ||
## 3.0.1 | ||
- Fixed: memory leak due to bug in `require-from-string`. | ||
- Added: for JSON files, append position to end of error message. | ||
## 3.0.0 | ||
@@ -4,0 +9,0 @@ |
@@ -138,7 +138,6 @@ // | ||
const splitPath = directory.split(path.sep); | ||
const nextDirectory = | ||
splitPath.length > 1 ? splitPath.slice(0, -1).join(path.sep) : null; | ||
const nextDirectory = path.dirname(directory); | ||
if (!nextDirectory || directory === options.stopDir) return null; | ||
if (nextDirectory === directory || directory === options.stopDir) | ||
return null; | ||
@@ -145,0 +144,0 @@ return searchDirectory(nextDirectory); |
@@ -49,5 +49,5 @@ // | ||
(jsonContent ) => { | ||
if (foundConfig) { | ||
return; | ||
} else if (jsonContent) { | ||
// Since this is the first try, config cannot have been found, so don't | ||
// check `if (foundConfig)`. | ||
if (jsonContent) { | ||
const successFilepath = `${filepath}.json`; | ||
@@ -105,6 +105,4 @@ foundConfig = { | ||
function readRcFile(extension ) { | ||
const filepathWithExtension = extension | ||
? `${filepath}.${extension}` | ||
: filepath; | ||
function readRcFile(extension ) { | ||
const filepathWithExtension = `${filepath}.${extension}`; | ||
return !options.sync | ||
@@ -111,0 +109,0 @@ ? readFile(filepathWithExtension) |
{ | ||
"name": "cosmiconfig", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Find and load configuration from a package.json property, rc file, or CommonJS module", | ||
"main": "dist/index.js", | ||
"files": [ | ||
"index.js", | ||
"dist" | ||
@@ -15,3 +14,3 @@ ], | ||
"pretest": "npm run lint && flow check", | ||
"test": "jest", | ||
"test": "jest --coverage", | ||
"test:watch": "jest --watch", | ||
@@ -58,3 +57,11 @@ "coverage": "jest --coverage --coverageReporters=html --coverageReporters=text", | ||
"src/*.js" | ||
] | ||
], | ||
"coverageThreshold": { | ||
"global": { | ||
"branches": 100, | ||
"functions": 100, | ||
"lines": 100, | ||
"statements": 100 | ||
} | ||
} | ||
}, | ||
@@ -69,11 +76,11 @@ "babel": { | ||
"js-yaml": "^3.9.0", | ||
"parse-json": "^2.2.0", | ||
"require-from-string": "^1.1.0" | ||
"parse-json": "^3.0.0", | ||
"require-from-string": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"babel-eslint": "^7.2.3", | ||
"babel-eslint": "^8.0.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.22.0", | ||
"eslint": "^4.5.0", | ||
"eslint": "^4.7.0", | ||
"eslint-config-davidtheclark-node": "^0.2.0", | ||
"eslint-config-prettier": "^2.3.0", | ||
"eslint-config-prettier": "^2.5.0", | ||
"eslint-plugin-flowtype": "^2.35.1", | ||
@@ -84,5 +91,5 @@ "eslint-plugin-node": "^3.0.5", | ||
"husky": "^0.14.3", | ||
"jest": "^20.0.4", | ||
"lint-staged": "^4.0.4", | ||
"prettier": "^1.6.1" | ||
"jest": "^21.1.0", | ||
"lint-staged": "^4.2.1", | ||
"prettier": "^1.7.0" | ||
}, | ||
@@ -89,0 +96,0 @@ "engines": { |
@@ -9,3 +9,2 @@ # cosmiconfig | ||
- a `.config.js` CommonJS module (anywhere down the file tree) | ||
- a CLI `--config` argument | ||
@@ -16,3 +15,2 @@ For example, if your module's name is "soursocks," cosmiconfig will search out configuration in the following places: | ||
- a `soursocks.config.js` file exporting a JS object (anywhere down the file tree) | ||
- a CLI `--config` argument | ||
@@ -68,3 +66,3 @@ cosmiconfig continues to search in these places all the way down the file tree until it finds acceptable configuration (or hits the home directory). | ||
All this searching can be short-circuited by passing `options.configPath` or a `--config` CLI argument to specify a file. | ||
All this searching can be short-circuited by passing `options.configPath` to specify a file. | ||
cosmiconfig will read that file and try parsing it as JSON, YAML, or JS. | ||
@@ -71,0 +69,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
28596
451
232
+ Addedparse-json@3.0.0(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
- Removedparse-json@2.2.0(transitive)
- Removedrequire-from-string@1.2.1(transitive)
Updatedparse-json@^3.0.0
Updatedrequire-from-string@^2.0.1