Fetch licences types and copies from all dependencies (and their dependencies) from project.
Open Source & legal team and a massive number of manual work...
npm install licenses-list-generator --save-dev
import licensesList from 'licenses-list-generator';
const licenses = licensesList();
Live example (will create ./static/licenses.txt file which contains licenses from all dependencies used in this project):
npm run licenses
Function returns array of objects with properties:
name | type | description |
---|---|---|
name | string | dependency name (from package.json) |
path | string | path to dependency, starting from root |
text | string | license text (see below) |
type | string | license type (from package.json) |
version | string | module version (from package.json) |
null in all cases if not found.
Function returns license information to module/project from which it is called as well.
It is a recursive walk through dependencies from package.json (to find dependencies and all its sub-dependencies). Module is searching for files: LICENSE, LICENSE.md, LICENSE.txt, LICENCE, LICENSE.markdown, LICENSE-MIT, LICENSE.rst. Other information, like license type, name or version, comes from package.json file.
Returned array contains information related project dependencies ONLY.
NOT devDependencies.