license-checker
Advanced tools
Comparing version 13.0.0 to 13.0.1
## Change Log | ||
### v13.0.1 (2017/07/17 12:47 +00:00) | ||
- [#113](https://github.com/davglass/license-checker/pull/113) Use LICENSE file in preference to README (#113) (@ibeucaly) | ||
- [6b7f79f](https://github.com/davglass/license-checker/commit/6b7f79f654e21903ea37e4391fba3601ece32e90) changes (@davglass) | ||
### v13.0.0 (2017/07/14 12:49 +00:00) | ||
- [dd9e880](https://github.com/davglass/license-checker/commit/dd9e880abd234d683d8c1e57e7a5f889c9156de4) 13.0.0 (@davglass) | ||
- [051b20b](https://github.com/davglass/license-checker/commit/051b20b0c4b35f223f724705a0025dafc809373f) cleaned up some tests (@davglass) | ||
@@ -5,0 +10,0 @@ - [#110](https://github.com/davglass/license-checker/pull/110) FEATURE: Recognise some custom licenses by file or url (#110) (@dancrumb) |
@@ -153,7 +153,17 @@ /* | ||
dirFiles = fs.readdirSync(json.path); | ||
files = dirFiles.filter(function(filename) { | ||
filename = filename.toUpperCase(); | ||
var name = path.basename(filename).replace(path.extname(filename), ''); | ||
return name === 'LICENSE' || name === 'LICENCE' || name === 'COPYING' || name === 'README'; | ||
// Find and list license files in the precedence order | ||
['LICENSE', 'LICENCE', 'COPYING', 'README'].forEach(function(licenseFilename) { | ||
var found = false; | ||
dirFiles.forEach(function(filename) { | ||
if (!found) { | ||
var basename = path.basename(filename, path.extname(filename)).toUpperCase(); | ||
if (basename === licenseFilename) { | ||
files.push(filename); | ||
found = true; | ||
} | ||
} | ||
}); | ||
}); | ||
noticeFiles = dirFiles.filter(function(filename) { | ||
@@ -166,3 +176,3 @@ filename = filename.toUpperCase(); | ||
files.forEach(function(filename) { | ||
files.forEach(function(filename, index) { | ||
licenseFile = path.join(json.path, filename); | ||
@@ -179,19 +189,20 @@ // Checking that the file is in fact a normal file and not a directory for example. | ||
var lf = options.basePath ? path.relative(options.basePath, licenseFile) : licenseFile; | ||
if (!content) { | ||
content = fs.readFileSync(lf, { encoding: 'utf8' }); | ||
} | ||
/*istanbul ignore else*/ | ||
if (include("licenseFile")) { | ||
moduleInfo.licenseFile = options.basePath ? path.relative(options.basePath, licenseFile) : licenseFile; | ||
} | ||
if (include("licenseText") && options.customFormat) { | ||
if (index === 0) { | ||
// Treat the file with the highest precedense as licenseFile | ||
/*istanbul ignore else*/ | ||
if (options._args && !options._args.csv) { | ||
moduleInfo.licenseText = content.trim(); | ||
} else { | ||
moduleInfo.licenseText = content.replace(/"/g, '\'').replace(/\r?\n|\r/g, " ").trim(); | ||
if (include("licenseFile")) { | ||
moduleInfo.licenseFile = options.basePath ? path.relative(options.basePath, licenseFile) : licenseFile; | ||
} | ||
if (include("licenseText") && options.customFormat) { | ||
if (!content) { | ||
content = fs.readFileSync(licenseFile, { encoding: 'utf8' }); | ||
} | ||
/*istanbul ignore else*/ | ||
if (options._args && !options._args.csv) { | ||
moduleInfo.licenseText = content.trim(); | ||
} else { | ||
moduleInfo.licenseText = content.replace(/"/g, '\'').replace(/\r?\n|\r/g, " ").trim(); | ||
} | ||
} | ||
} | ||
@@ -198,0 +209,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"author": "Dav Glass <davglass@gmail.com>", | ||
"version": "13.0.0", | ||
"version": "13.0.1", | ||
"contributors": [ | ||
@@ -37,2 +37,3 @@ "Adam Weber <adamweber01@gmail.com>", | ||
"Timothée Mazzucotelli <timothee.mazzucotelli@gmail.com>", | ||
"Yukari Ishibashi <ibeucaly@users.noreply.github.com>", | ||
"Yuri Zapuchlak <yuri@vidmaker.com>", | ||
@@ -39,0 +40,0 @@ "badunk <baduncaduncan@gmail.com>", |
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
103437
1332