generate-license-file
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Generate License File

A CLI and code library to generate a text file containing all of the licenses for your production third-party dependencies.

npm

Installation and Usage (CLI)

$ npm install generate-license-file --save-dev

$ npx generate-license-file --input package.json --output third-party-licenses.txt --overwrite
Argument Description
--input Absolute or relative path to the package.json for the project.
--output Absolute or relative path for the generated output file.
--overwrite (optional) Allows the CLI to overwrite existing output files. If this option is not provided and the output file already exists, you will be prompted to confirm.
--eol (optional) Specify the line endings used in the output file. Accepted values are crlf or lf. If no value is provided your system default will be used.
--ci (optional) Stops the CLI from prompting the user for inputs and instead exits with a non-zero exit code.
--no-spinner (optional) Disable the CLI spinner while the output file is being generated.
--version (optional) Print the installed generate-license-file version.

If either the --input or --output are omitted the CLI will prompt you for their values.

For a full description of the CLI arguments and their usages please see the relevant docs page.

Installation and Usage (Library API)

$ npm install generate-license-file --save-dev

TypeScript

import { generateLicenseFile, getLicenseFileText, getProjectLicenses } from "generate-license-file";

// Generate the license file and write it to disk.
await generateLicenseFile("./package.json", "./third-party-licenses.txt");

// Generate the license file content and return it as a string.
const licenseFileText: string = await getLicenseFileText("./package.json");

// Get an array of objects each containing the details of an
// identified license and the dependencies it pertains to.
const licenses: ILicense[] = await getProjectLicenses("./package.json");

JavaScript

const generateLicenseFile = require("generate-license-file");

// The same library methods can be used in JS, e.g.
generateLicenseFile
  .getProjectLicenses("./package.json")
  .then(licenses => {
    // Do stuff with licenses...
  })
  .catch(error => {
    // Do stuff with error...
  });

For a full description of the library API and example usages please see the relevant docs page.

License

generate-license-file is licensed under the ISC License.

Install

npm i generate-license-file

DownloadsWeekly Downloads

11,904

Version

2.0.0

License

ISC

Unpacked Size

47.1 kB

Total Files

42

Last publish

Collaborators

  • tobybessant
  • tobysmith568