diff --git a/lib/index.js b/lib/index.js index d98f134..d6d169a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -27,6 +27,7 @@ var flatten = function(options) { key = json.name + '@' + json.version, colorize = options.color, unknown = options.unknown, + readmeFile, licenseData, files = [], licenseFile; /*istanbul ignore next*/ @@ -97,6 +98,14 @@ var flatten = function(options) { } licenseData = json.license || json.licenses || undefined; + + if (json.path && (!json.readme || json.readme.toLowerCase().indexOf('no readme data found') > -1)) { + readmeFile = path.join(json.path, 'README.md'); + if (fs.existsSync(readmeFile)) { + json.readme = fs.readFileSync(readmeFile, 'utf8').toString(); + } + } + if (licenseData) { /*istanbul ignore else*/ if (Array.isArray(licenseData) && licenseData.length > 0) {