read-pkg-up
Advanced tools
Comparing version 4.0.0 to 5.0.0
26
index.js
'use strict'; | ||
const path = require('path'); | ||
const findUp = require('find-up'); | ||
const readPkg = require('read-pkg'); | ||
module.exports = options => { | ||
return findUp('package.json', options).then(fp => { | ||
if (!fp) { | ||
return {}; | ||
} | ||
module.exports = async options => { | ||
const filePath = await findUp('package.json', options); | ||
return readPkg(fp, options).then(pkg => ({pkg, path: fp})); | ||
}); | ||
if (!filePath) { | ||
return {}; | ||
} | ||
return { | ||
pkg: await readPkg({...options, cwd: path.dirname(filePath)}), | ||
path: filePath | ||
}; | ||
}; | ||
module.exports.sync = options => { | ||
const fp = findUp.sync('package.json', options); | ||
const filePath = findUp.sync('package.json', options); | ||
if (!fp) { | ||
if (!filePath) { | ||
return {}; | ||
@@ -23,5 +27,5 @@ } | ||
return { | ||
pkg: readPkg.sync(fp, options), | ||
path: fp | ||
pkg: readPkg.sync({...options, cwd: path.dirname(filePath)}), | ||
path: filePath | ||
}; | ||
}; |
{ | ||
"name": "read-pkg-up", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "Read the closest package.json file", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=6" | ||
"node": ">=8" | ||
}, | ||
@@ -52,8 +52,8 @@ "scripts": { | ||
"find-up": "^3.0.0", | ||
"read-pkg": "^3.0.0" | ||
"read-pkg": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
"ava": "^1.3.1", | ||
"xo": "^0.24.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
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
4320
24
1
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@types/normalize-package-data@2.4.4(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedlines-and-columns@1.2.4(transitive)
+ Addedparse-json@5.2.0(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedread-pkg@5.2.0(transitive)
+ Addedtype-fest@0.6.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedjson-parse-better-errors@1.0.2(transitive)
- Removedload-json-file@4.0.0(transitive)
- Removedparse-json@4.0.0(transitive)
- Removedpath-type@3.0.0(transitive)
- Removedpify@3.0.0(transitive)
- Removedread-pkg@3.0.0(transitive)
- Removedstrip-bom@3.0.0(transitive)
Updatedread-pkg@^5.0.0