read-package-json
Advanced tools
Comparing version 1.1.7 to 1.1.8
{ | ||
"name": "read-package-json", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"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", |
@@ -234,3 +234,3 @@ // vim: set softtabstop=16 shiftwidth=16: | ||
var globOpts = { cwd: dir, nocase: true, mark: true } | ||
glob("README?(.*)", globOpts, function (er, files) { | ||
glob("{README,README.*}", globOpts, function (er, files) { | ||
if (er) return cb(er); | ||
@@ -242,6 +242,20 @@ // don't accept directories. | ||
if (!files.length) return cb(); | ||
var rm = path.resolve(dir, files[0]) | ||
var fn = preferMarkdownReadme(files) | ||
var rm = path.resolve(dir, fn) | ||
readme_(file, data, rm, cb) | ||
}) | ||
} | ||
function preferMarkdownReadme(files) { | ||
var fallback = 0; | ||
var re = /\.m?a?r?k?d?o?w?n?$/i | ||
for (var i = 0; i < files.length; i++) { | ||
if (files[i].match(re)) | ||
return files[i] | ||
else if (files[i].match(/README$/)) | ||
fallback = i | ||
} | ||
// prefer README.md, followed by README; otherwise, return | ||
// the first filename (which could be README) | ||
return files[fallback]; | ||
} | ||
function readme_(file, data, rm, cb) { | ||
@@ -248,0 +262,0 @@ var rmfn = path.basename(rm); |
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
28142
16
551
5