read-package-json
Advanced tools
Comparing version 2.0.13 to 2.1.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="2.1.0"></a> | ||
# [2.1.0](https://github.com/npm/read-package-json/compare/v2.0.13...v2.1.0) (2019-08-13) | ||
### Features | ||
* support bundleDependencies: true ([76f6f42](https://github.com/npm/read-package-json/commit/76f6f42)) | ||
<a name="2.0.13"></a> | ||
@@ -7,0 +17,0 @@ ## [2.0.13](https://github.com/npm/read-package-json/compare/v2.0.12...v2.0.13) (2018-03-08) |
{ | ||
"name": "read-package-json", | ||
"version": "2.0.13", | ||
"version": "2.1.0", | ||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", | ||
@@ -5,0 +5,0 @@ "description": "The thing npm uses to read package.json files with semantics and defaults and validation", |
@@ -20,2 +20,3 @@ var fs | ||
readJson.extraSet = [ | ||
bundleDependencies, | ||
gypfile, | ||
@@ -328,2 +329,19 @@ serverjs, | ||
function bundleDependencies (file, data, cb) { | ||
var bd = 'bundleDependencies' | ||
var bdd = 'bundledDependencies' | ||
// normalize key name | ||
if (data[bdd] !== undefined) { | ||
if (data[bd] === undefined) data[bd] = data[bdd] | ||
delete data[bdd] | ||
} | ||
if (data[bd] === false) delete data[bd] | ||
else if (data[bd] === true) { | ||
data[bd] = Object.keys(data.dependencies || {}) | ||
} else if (data[bd] !== undefined && !Array.isArray(data[bd])) { | ||
delete data[bd] | ||
} | ||
return cb(null, data) | ||
} | ||
function githead (file, data, cb) { | ||
@@ -390,13 +408,12 @@ if (data.gitHead) return cb(null, data) | ||
var relName = data.bin[key] | ||
try { | ||
var binPath = path.resolve(dirName, relName) | ||
fs.stat(binPath, (err) => handleExists(relName, !err)) | ||
} catch (error) { | ||
if (error.message === 'Arguments to path.resolve must be strings' || error.message.indexOf('Path must be a string') === 0) { | ||
warn('Bin filename for ' + key + ' is not a string: ' + util.inspect(relName)) | ||
handleExists(relName, true) | ||
} else { | ||
cb(error) | ||
} | ||
if (typeof relName !== 'string') { | ||
var msg = 'Bin filename for ' + key + | ||
' is not a string: ' + util.inspect(relName) | ||
warn(msg) | ||
delete data.bin[key] | ||
handleExists(relName, true) | ||
return | ||
} | ||
var binPath = path.resolve(dirName, relName) | ||
fs.stat(binPath, (err) => handleExists(relName, !err)) | ||
}) | ||
@@ -403,0 +420,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
18828
410