Standalone CLI (Node.js)
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.
Installation
To get started, install the package using your preferred package manager:
Features
- 🔍 Scan and aggregate license information from your project dependencies
- ⚠️ Detect copyleft licenses that might affect your project
- 📝 Generate license reports in a format of choice (JSON, Markdown, raw text, AboutLibraries-compatible JSON metadata)
- 🔄 Support for both direct and transitive dependencies
Quick Start
Run the license check in your project root:
Usage
Basic Usage
Command Line Options
Command: 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-weakis set)
Command: report
Generates a licenses report in the specified format. The output can be written to stdout (default) or a file.
Command: analyze
Scan licenses & report the insights: summary, top license types, optionally unknowns & breakdown of licenses by different features.
Command: visualize
Launches a local server providing a web license graph visualizer & analyzer app: summarizes the dependency graph state, shows an interactive graph of licenses with possibility to select a subgraph, provides browser built-in AI-turbocharged summary of the dependency graph.
Command: help
Displays help, listing the available commands.
General options
General options that can be passed to the CLI with after any command.
No-command options help
General options that can be passed to the CLI with after any command.
Additional details
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 @callstack/licenses 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.
Known Limitations
For a list of known limitations, please see the Known Limitations section in the @callstack/licenses package's documentation.
