|
sfcode
An Online Competing and Development Environment
|
Below is an example of how to add the plugin to a webpack config:
stats** - toggle warnings and errors on/off (default: report warnings and errors)Example:
licenseInclusionTest** - filter which licenses get included in the report (default: capture all licenses)Example:
Notes: All license identifiers in npm packages are supposed to follow SPDX format. If your requirements are very specific, it is recommended to set up this option using the spdx-satisfies package. The plugin does not provide the spdx-satisfies package, so you must install it separately if you want to use it.
Example using spdx-satisfies:
outputFilename** - customize the license report filename (default: ‘’[name].licenses.txt'`)Example:
unacceptableLicenseTest** - error out on unacceptable license (default: disabled)Example:
handleUnacceptableLicense** - do something when an unacceptable license is found (default: disabled)Example:
excludedPackageTest** - exclude packages (default: disabled)Example:
perChunkOutput** - control whether or not the license files are generated per chunk or are combined into one file (default: true)Example:
addBanner** - write a banner to the top of each js file (default: false)Example:
licenseTypeOverrides** - override the license type for specific packages (default: disabled)Example:
licenseTextOverrides** - override the license text for specific packages (default: disabled)Example:
licenseFileOverrides** - override the license filename for specific packages (default: disabled)Example:
Notes: The license filename is resolved relative to the package directory.
renderLicenses** - change the format / contents of the generated license file (default: print package name, license type, and license text)Example:
renderBanner** - change the format / contents of the banner written to the top of each js file (default: print message indicating license filename)Example:
handleMissingLicenseText** - do something when license text is missing from a package (default: disabled)Example:
Notes: You can return your own license text from this function, but you should prefer using licenseTextOverrides first.
licenseTemplateDir** - use fallback license files for when a package is missing a license file (default: disabled)Example:
Notes: This option specifies a directory containing .txt files containing the license text based on the license type. (e.g. MIT.txt). Templates can be found here.
chunkIncludeExcludeTest** - control which chunks gets processed by the plugin (default: all chunks get processed)Example:
Example:
Notes: If there is a duplicate entry in both the exclude and include array, the duplicated entry will be excluded.
modulesDirectories** - limit which directories get scanned for license files (default: disabled)Example:
additionalChunkModules** - add additional node modules to a chunk (default: disabled)Example:
additionalModules** - add additional node modules to the scan (default: disabled)Example:
preferredLicenseTypes** - help the plugin decide which license type to pick in case a package specifies multiple licenses (default: disabled)Example:
handleLicenseAmbiguity** - do something when the plugin finds ambiguous license types (default: pick first license type)Example:
Notes: This function is called whenever a license type could not be determined when a package uses the deprecated licenses field (which is an array of license types) in its package.json. It should return the license type to use. By default, the plugin prints a warning message to the console and chooses the first license type. You should use the preferredLicenseTypes option instead of this one.
handleMissingLicenseType** - do something when a package is missing a license type (default: disabled)Example:
Notes: You can return a license type from this function, but it is a better idea to use the licenseTypeOverides option.
skipChildCompilers** - do not apply the plugin to child webpack compilers (default: applies to child compilers too)Example: