rollup-plugin-license-xml

Generates a xml with the licenses of your runtime dependencies

Usage no npm install needed!

<script type="module">
  import rollupPluginLicenseXml from 'https://cdn.skypack.dev/rollup-plugin-license-xml';
</script>

README

rollup-plugin-license-xml NPM version

rollup-plugin-license-xml

Creates a license.xml file from all your dependencies see template

Install

$ npm install --save-dev rollup-plugin-license-xml

Usage

Importing or Requiring

Import as ES Module

import license from 'rollup-plugin-license-xml'

Requiring as CJS

const license = require('rollup-plugin-license-xml')

Usage from rollup config

export default {
  entry: 'module.js',
  dest: 'index.js',
  format: 'cjs',
  plugins: [license()]
}

Usage from build script

rollup({
  entry: 'main.js',
  plugins: [license()]
}).then(...)

results

logged to console on rollup completion

<other>
    <description>rollup-plugin-license-xml</description>
    <locations>
        <file>/test/_fixtures/bundle-a.js</file>
    </locations>
    <licenses>
    <license>
        <name>MIT</name>
        <url>https://raw.githubusercontent.com/edewit/rollup-plugin-license/master/LICENSE</url>
    </license>
    </licenses>
</other>
<other>
  ...

Options

  • root - optional
    • type: String
    • default: process.cwd()
    • description: Application directory, used to display file paths relatively
  • writeTo - optional
    • type: Function
    • default: null
    • description: Callback to be invoked with formatted string
    • function will be invoked with:
      • analysisString (String)
  • onAnalysis - optional
    • type: Function
    • default: null
    • description: Callback to be invoked with analysis object
    • function will be invoked with:
      • analysisObject (Object)
        • modules (Array) - array of module analysis objects
          • module (Object)
            • id (String) - path of module / rollup module id
            • files (Array) - list of files