Caution
This project has been migrated to scanner monorepo
Fetch all licenses and their SPDX conformance from a given npm tarball.
- Node.js v18 or higher
This package is available in the Node Package Repository and can be easily installed with npm or yarn.
$ npm i @nodesecure/ntlp
# or
$ yarn add @nodesecure/ntlp
import * as ntlp from "@nodesecure/ntlp";
// Asynchronous
{
const licenses = await ntlp.extractLicenses(process.cwd());
console.log(licenses);
}
// Synchronous
{
const licenses = ntlp.extractLicensesSync(process.cwd());
console.log(licenses);
}
Search and parse all licenses at the given location.
Return all licenses with their SPDX conformance.
import {
spdxLicenseConformance
} from "@nodesecure/licenses-conformance";
export interface SpdxLicenseConformance extends spdxLicenseConformance {
from: string;
}
export interface SpdxExtractedResult {
/**
* List of license (with their SPDX conformance)
*/
licenses: SpdxLicenseConformance[];
/**
* Has multiple unique licenses (MIT, ISC ..)
*/
hasMultipleLicenses: boolean;
/**
* Unique list of license (MIT, ISC). The list cannot contain duplicate.
*/
uniqueLicenseIds: string[];
/**
* List of licenses with no SPDX (or with invalid ids).
*/
invalidLicenseIds: string[];
}
Same as extractLicenses
but use synchronous FS API.
Thanks goes to these wonderful people (emoji key):
Gentilhomme 💻 📖 👀 🛡️ 🐛 |
Tony Gorez 💻 📖 👀 |
Quentin Lepateley 📖 |
Nicolas Hallaert 📖 |
Vincent Dhennin 💻 |
Kouadio Fabrice Nguessan 🚧 |
MIT