read-package-json
Advanced tools
Comparing version 2.0.12 to 2.0.13
{ | ||
"name": "read-package-json", | ||
"version": "2.0.12", | ||
"version": "2.0.13", | ||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", | ||
@@ -12,7 +12,11 @@ "description": "The thing npm uses to read package.json files with semantics and defaults and validation", | ||
"scripts": { | ||
"test": "standard && tap -J test/*.js" | ||
"prerelease": "npm t", | ||
"postrelease": "npm publish && git push --follow-tags", | ||
"pretest": "standard", | ||
"release": "standard-version -s", | ||
"test": "tap --nyc-arg=--all --coverage test/*.js" | ||
}, | ||
"dependencies": { | ||
"glob": "^7.1.1", | ||
"json-parse-better-errors": "^1.0.0", | ||
"json-parse-better-errors": "^1.0.1", | ||
"normalize-package-data": "^2.0.0", | ||
@@ -22,4 +26,5 @@ "slash": "^1.0.0" | ||
"devDependencies": { | ||
"standard": "^9.0.1", | ||
"tap": "^10.3.0" | ||
"standard": "^11.0.0", | ||
"standard-version": "^4.3.0", | ||
"tap": "^11.1.2" | ||
}, | ||
@@ -26,0 +31,0 @@ "optionalDependencies": { |
@@ -342,6 +342,22 @@ var fs | ||
} | ||
var headFile = head.replace(/^ref: /, '').trim() | ||
headFile = path.resolve(dir, '.git', headFile) | ||
var headRef = head.replace(/^ref: /, '').trim() | ||
var headFile = path.resolve(dir, '.git', headRef) | ||
fs.readFile(headFile, 'utf8', function (er, head) { | ||
if (er || !head) return cb(null, data) | ||
if (er || !head) { | ||
var packFile = path.resolve(dir, '.git/packed-refs') | ||
return fs.readFile(packFile, 'utf8', function (er, refs) { | ||
if (er || !refs) { | ||
return cb(null, data) | ||
} | ||
refs = refs.split('\n') | ||
for (var i = 0; i < refs.length; i++) { | ||
var match = refs[i].match(/^([0-9a-f]{40}) (.+)$/) | ||
if (match && match[2].trim() === headRef) { | ||
data.gitHead = match[1] | ||
break | ||
} | ||
} | ||
return cb(null, data) | ||
}) | ||
} | ||
head = head.replace(/^ref: /, '').trim() | ||
@@ -375,3 +391,3 @@ data.gitHead = head | ||
var binPath = path.resolve(dirName, relName) | ||
fs.exists(binPath, handleExists.bind(null, relName)) | ||
fs.stat(binPath, (err) => handleExists(relName, !err)) | ||
} catch (error) { | ||
@@ -378,0 +394,0 @@ if (error.message === 'Arguments to path.resolve must be strings' || error.message.indexOf('Path must be a string') === 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
18186
5
394
3