license-checker
Advanced tools
Comparing version 13.0.3 to 13.1.0
## Change Log | ||
### 13.0.3 (2017/08/04 17:15 +00:00) | ||
### v13.1.0 (2017/08/25 14:59 +00:00) | ||
- [#121](https://github.com/davglass/license-checker/pull/121) Add `--summary` mode to show a summary with counts of the used licenses (#121) (@tobilg) | ||
- [#119](https://github.com/davglass/license-checker/pull/119) Fix minor spelling mistakes (#119) (@tobiasbueschel) | ||
- [#118](https://github.com/davglass/license-checker/pull/118) Minor readme text improvements (#118) (@peteruithoven) | ||
- [d2bc5ea](https://github.com/davglass/license-checker/commit/d2bc5ea91ab50becea91d5f0f050955fe9a6ac59) added license parsing info to README (@davglass) | ||
- [3e9d320](https://github.com/davglass/license-checker/commit/3e9d320acb2e9f14297d6a4355680f34a9b0609d) changes (@davglass) | ||
### v13.0.3 (2017/08/04 17:15 +00:00) | ||
- [2caf76b](https://github.com/davglass/license-checker/commit/2caf76be7f2849e153ee28410f3b7a41df3283b5) 13.0.3 (@davglass) | ||
@@ -5,0 +12,0 @@ - [fadddc8](https://github.com/davglass/license-checker/commit/fadddc895ef9c6f182e2283c5605a8c1d8fa8a25) [fixes #117] fixed minor URL parsing (@davglass) |
@@ -27,3 +27,4 @@ /* | ||
customFormat: { }, | ||
files: require('path') | ||
files: require('path'), | ||
summary: Boolean | ||
}, | ||
@@ -30,0 +31,0 @@ shorts = { |
@@ -386,2 +386,32 @@ /* | ||
exports.asSummary = function(sorted) { | ||
var licenseCountObj = {}; | ||
var licenceCountArray = []; | ||
var sortedLicenseCountObj = {}; | ||
Object.keys(sorted).forEach(function(key) { | ||
if (sorted[key].licenses) { | ||
if (!licenseCountObj[sorted[key].licenses]) { | ||
licenseCountObj[sorted[key].licenses] = 0; | ||
} | ||
licenseCountObj[sorted[key].licenses]++; | ||
} | ||
}); | ||
Object.keys(licenseCountObj).forEach(function(license) { | ||
licenceCountArray.push({ license: license, count: licenseCountObj[license] }); | ||
}); | ||
/*istanbul ignore next*/ | ||
licenceCountArray.sort(function(a, b) { | ||
return b['count'] - a['count']; | ||
}); | ||
licenceCountArray.forEach(function(licenseObj) { | ||
sortedLicenseCountObj[licenseObj.license] = licenseObj.count; | ||
}); | ||
return treeify.asTree(sortedLicenseCountObj, true); | ||
}; | ||
exports.asCSV = function(sorted, customFormat, csvComponentPrefix) { | ||
@@ -388,0 +418,0 @@ var text = [], textArr = [], lineArr = []; |
@@ -5,3 +5,3 @@ { | ||
"author": "Dav Glass <davglass@gmail.com>", | ||
"version": "13.0.3", | ||
"version": "13.1.0", | ||
"contributors": [ | ||
@@ -29,2 +29,3 @@ "Adam Weber <adamweber01@gmail.com>", | ||
"Paul Mandel <paul.mand3l@gmail.com>", | ||
"Peter Uithoven <peter@peteruithoven.nl>", | ||
"Philipp Tusch <philipp.tusch@huf-group.com>", | ||
@@ -38,2 +39,4 @@ "Stan Senotrusov <stan@senotrusov.com>", | ||
"Timothée Mazzucotelli <timothee.mazzucotelli@gmail.com>", | ||
"Tobi <tobilg@gmail.com>", | ||
"Tobias Büschel <tobias.bueschel@gmail.com>", | ||
"Yukari Ishibashi <ibeucaly@users.noreply.github.com>", | ||
@@ -40,0 +43,0 @@ "Yuri Zapuchlak <yuri@vidmaker.com>", |
NPM License Checker | ||
=================== | ||
Ever needed to see all the license info for a module and its dependencies? | ||
Ever needed to see all the license info for a module and it's dependencies? | ||
It's this easy: | ||
``` | ||
```shell | ||
npm install -g license-checker | ||
@@ -82,3 +81,3 @@ | ||
---------- | ||
A list of licenses is the simples way to describe what you want to exclude. | ||
A list of licenses is the simplest way to describe what you want to exclude. | ||
@@ -163,5 +162,12 @@ You can use valid [SPDX identifiers](https://spdx.org/licenses/). | ||
build status | ||
How Licenses are Found | ||
---------------------- | ||
We walk through the `node_modules` directory with the [`read-installed`](https://www.npmjs.org/package/read-installed) module. Once we gathered a list of modules we walk through them and look at all of their `package.json`'s, We try to identify the license with the [`spdx`](https://www.npmjs.com/package/spdx) module to see if it has a valid SPDX license attached. If that fails, we then look into the module for the following files: `LICENSE`, `LICENCE`, `COPYING`, & `README`. | ||
If one of the those files are found (in that order) we will attempt to parse the license data from it with a list of known license texts. This will be shown with the `*` next to the name of the license to show that we "guessed" at it. | ||
Build Status | ||
------------ | ||
[![Build Status](https://travis-ci.org/davglass/license-checker.png?branch=master)](https://travis-ci.org/davglass/license-checker) |
@@ -311,3 +311,3 @@ var assert = require('assert'), | ||
['json', 'markdown', 'csv'].forEach(function(type) { | ||
['json', 'markdown', 'csv', 'summary'].forEach(function(type) { | ||
it('should disable color on ' + type, function() { | ||
@@ -515,2 +515,13 @@ var def = { | ||
}); | ||
it('as summary', function() { | ||
var data = checker.asSummary({ | ||
foo: { | ||
licenses: 'MIT', | ||
repository: '/path/to/foo' | ||
} | ||
}); | ||
assert.ok(data); | ||
assert.ok(data.indexOf('└─') > -1); | ||
}); | ||
@@ -517,0 +528,0 @@ it('as files', function() { |
Sorry, the diff of this file is not supported yet
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
108010
1379
172