[](https://sonarcloud.io/dashboard?id=tmorelllicense-compliance) [](https://sonarcloud.io/dashboard?id=tmorelllicense-compliance)
[](https://github.com/tmorell/license-compliance/blob/master/LICENSE)
License Compliance
Analyzes installed packages allowing to verify compliance with allowed licenses.
Installation
npm install --save-dev license-complianceExamples
Getting a summary of all installed packages (production and development).
$ license-compliance
Licenses
├─ MIT: 366
├─ ISC: 46
├─ BSD-3-Clause: 11
├─ BSD-2-Clause: 9
├─ Apache-2.0: 6
├─ (MIT OR CC0-1.0): 3
├─ UNKNOWN: 3
└─ (BSD-2-Clause OR MIT OR Apache-2.0): 1Verify compliance by providing list of allowed licenses.
$ license-compliance --production --allow "MIT;ISC" --report detailed
Packages
├─ spdx-exceptions@2.2.0
│ ├─ Licenses: CC-BY-3.0
│ └─ Path: node_modules/spdx-exceptions
└─ spdx-license-ids@3.0.5
├─ Licenses: CC0-1.0
└─ Path: node_modules/spdx-license-idsIf there are non compliant packages, it exits with code 1, and outputs the non compliant packages.
$ license-compliance --production --allow "MIT;ISC;CC-BY-3.0;CC0-1.0"If all packages are compliant, it exits with code 0 and no additional output.
Find which packages have a specific license.
$ license-compliance --production --report detailed --query "MIT"
Packages
├─ @babel/code-frame@7.18.6
│ ├─ Licenses: MIT
│ ├─ License file: node_modules/@babel/code-frame/LICENSE
│ ├─ Path: node_modules/@babel/code-frame
│ └─ Repository: https://github.com/babel/babel
└─ @babel/helper-validator-identifier@7.19.1
├─ Licenses: MIT
├─ License file: node_modules/@babel/helper-validator-identifier/LICENSE
├─ Path: node_modules/@babel/helper-validator-identifier
## Options
- `-p, --production` Analyzes only production dependencies.
- `-d, --development` Analyzes only development dependencies.
- `-t, --direct` Analyzes only direct dependencies (depth = 1).
- `-f, --format <format>` Report format, csv, text, json, or xunit (default = "text").
- `-r, --report <report>` Report type, summary or detailed (default = "summary").
- `-a, --allow <licenses>` Semicolon separated list of allowed licenses.
- `-e, --exclude <packages>` Semicolon separated list of package names to be excluded from the analysis. Regex expressions are supported.
- `-q, --query <licenses>` Semicolon separated list of licenses.
- `-v, --version` Display license-compliance version- -h, --help Display help for command