@entryscape/print-licenses
v2.1.0
Published
Prints a formatted list of direct production dependencies and their licenses.
Readme
print-licenses
A command-line tool to print a formatted list of direct production dependencies and their licenses.
This utility is specifically designed for projects that use pnpm as their package manager, as it relies on the pnpm licenses list command to gather dependency information. It fetches official license details from the SPDX license list and cross-references them with the licenses reported by pnpm.
Installation
Install the package as a development dependency in your project.
pnpm add -D print-licensesUsage
Add the command to the scripts section of your package.json:
"scripts": {
"print-licenses": "print-licenses"
}Then, you can generate the report by running the script from your terminal:
pnpm print-licensesExample Output
The script will output a list of licenses, sorted by the number of packages that use them. Each license includes a link to its official page, followed by a list of the packages that use it.
Fetching SPDX license data...
Reading direct dependencies from package.json...
Getting (unfiltered) license data from pnpm...
Filtering pnpm's data to only keep direct dependencies...
Generating the report string...
----------------------------------------
MIT, [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT)
[email protected], [https://react.dev/](https://react.dev/)
[email protected], [https://react.dev/](https://react.dev/)
----------------------------------------