kessler / license-report

create a short report about a project's dependencies (license, url etc)
MIT License
223 stars 39 forks source link

Any JavaScript method exposed to get list of dependent packages? #145

Closed SujayCN closed 11 months ago

SujayCN commented 1 year ago

Hi,

This tool is really helping in listing dependency list way better, thank you.

My query is, does this package expose any method to run this script as similar to below package? https://www.npmjs.com/package/license-checker `var checker = require('license-checker');

checker.init({ start: '/path/to/start/looking' }, function(err, packages) { if (err) { //Handle error } else { //The sorted package data //as an Object } });`

Thanks, Sujay

BePo65 commented 1 year ago

No, there is no documented way to use license-report like this.

But as the documentation says:

Besides the 'build-in' fields ("department", "name", "installedVersion", "author" "comment", "licensePeriod", "licenseType", "link", "material", "relatedTo"), any field allowed in a package.json can be used in the fields array (as "custom" field).

Then you can use the output of 'license-report' (e.g.in json format) as input to your own program and this way do what you want with the data from a package.json. The license-downloader is an example for this.