We expose the license-kit
package as a CLI for managing and analyzing Open Source Software (OSS) licenses in your Node.js projects. This package helps you aggregate license information and ensure compliance with license requirements.
To get started, install the package using your preferred package manager:
Run the license check in your project root:
copyleft
Check for copyleft licenses. Exits with error code (≠ 0) if strong copyleft licenses are found. Can be configured to exit with non-zero exit code if weak copyleft licenses are found as well.
Exit codes:
0
- no copyleft licenses found1
- strong copyleft licenses found2
- weak copyleft licenses found (if --error-on-weak
is set)Flag / Option | Description | Default |
---|---|---|
--tm, --transitive-deps-mode [mode] |
Controls, which transitive dependencies are included:
|
'all' |
--dm, --dev-deps-mode [mode] |
|
'root-only' |
--od, --include-optional-deps [include] |
Whether to include optionalDependencies in the scan; other flags apply | true |
--root [path] |
Path to the root of your project | Current working directory |
--error-on-weak |
Exit with error code if weak copyleft licenses are found | false |
report
Generates a licenses report in the specified format. The output can be written to stdout
(default) or a file.
Flag / Option | Description | Default |
---|---|---|
--tm, --transitive-deps-mode [mode] |
Controls, which transitive dependencies are included:
|
'all' |
--dm, --dev-deps-mode [mode] |
|
'root-only' |
--od, --include-optional-deps [include] |
Whether to include optionalDependencies in the scan; other flags apply | true |
--root [path] |
Path to the root of your project | Current working directory |
--format [type] |
Output format, one of: 'json' , 'about-json' (AboutLibraries-compatible), 'text' , 'markdown' |
'json' |
--output [path] |
Where to write the output - either 'stdout' or a path to an output file |
'stdout' |
help
Displays help, listing the available commands.
General options that can be passed to the CLI with after any command.
Option | Description |
---|---|
--version |
Outputs the version of the CLI. |
--help |
Displays help for the command. |
help
General options that can be passed to the CLI with after any command.
Option | Description |
---|---|
--version |
Outputs the version of the CLI. |
--help |
Displays help for the command. |
While the --dev-deps-mode
option is set to root-only
by default in the CLI, the programmatic API package has a default value for the optional scanOptionsFactory
that has includeDevDependencies
set to false
by default (equivalent of CLI's none
).
The reason for this discrepancy is to provide default behaviour backwards compatibility & consistency for the shared package while maintaining usability of the CLI. Sometimes bundlers do not take into account the fact the a dependency is a devDependency
, which results in them being bundled. Therefore, the CLI by default aggregates their licenses as well.
If you want the same behaviour as in the programmatic API, you can set the --dm
option to none
when running the CLI.
For more notes on the mechanics of the tool, please see core additional details section.
For a list of known limitations, please see the Known Limitations section in the shared package's documentation.