Git Product home page Git Product logo

license-webpack-plugin's Introduction

License Webpack Plugin

Build Status

This webpack plugin finds all 3rd party libraries used in a webpack build whose licenses match a given regex, and outputs the licenses for each package in your webpack build directory.

Installation

npm install license-webpack-plugin --save-dev

Usage

First, import the plugin into your webpack configuration:

var LicenseWebpackPlugin = require('license-webpack-plugin');

The plugin requires you to specify a regular expression for licenses to match under the pattern property.

To use the plugin, simply add it to your webpack config's plugin list.

The below example matches MIT, ISC, and any license starting with BSD.

new LicenseWebpackPlugin({
  pattern: /^(MIT|ISC|BSD.*)$/
});

Below are all options that can be passed to the plugin:

  • pattern A regular expression of license names to match. The license is read from the license property in package.json for each module used in your webpack output.
  • filename This is the output filename which gets written your webpack build directory. The default is 3rdpartylicenses.txt.
  • includeUndefined whether include packages without license or not. The default is false
  • addLicenseText whether include license text to output file or not. The default is true
  • addUrl whether include url to repository to output file or not. The default is false
  • licenseFilenames A list of license filenames to match, in order of priority. The default is ['LICENSE', 'LICENSE.md', 'LICENSE.txt', 'license', 'license.md', 'license.txt']
  • licenseTemplateDir Directory containing .txt files corresponding to SPDX license identifiers. This directory is referred to when the plugin cannot find a license file per the licenseFilenames property. Typically you would clone the SPDX master files repository and use the resulting directory containing all the various license .txt as the licenseTemplateDir for the plugin.
  • licenseOverrides An object whose keys are module names and values are filenames to use for the license file. Used when you want to override a license file for a particular module.
  • licenseTypeOverrides An object whose keys are module names and values are SPDX license identifier strings (e.g. 'MIT'). Allows you to override the license type for any module.
  • suppressErrors (default: false) Set to true to avoid having the plugin write error messages to the console

If a license file cannot be found and includeUndefined property is set to false, the plugin will write whatever the license property contains in the module's package.json and print an error.

License

ISC

license-webpack-plugin's People

Contributors

cakeinpanic avatar xz64 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.