Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@transmission-dynamics/esbuild-plugin-license

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@transmission-dynamics/esbuild-plugin-license

Manage third-party license compliance in your esbuild

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-69.23%
Maintainers
0
Weekly downloads
 
Created
Source

@transmission-dynamics/esbuild-plugin-license

npm (tag) npm

License generation tool similar to https://github.com/mjeanroy/rollup-plugin-license

Contributors

Usage

npm i -D @transmission-dynamics/esbuild-plugin-license
import * as esbuild from 'esbuild'
import esbuildPluginLicense from 'esbuild-plugin-license';

esbuild.build({
  entryPoints: ['index.ts'],
  outdir: 'dist',
  plugins: [esbuildPluginLicense()],
  bundle: true,
  platform: 'node'
})

Config

The available options are:

NameDescription
additionalFilesDefault: {}. An object that defines additional files to be generated by the plugin based on its default output (e.g., an HTML representation of the licenses in addition to the generated JSON). The keys represent filenames, while the values are functions invoked with the packages array and return the content to be written to the additional file. These functions can return a string or a Promise<string>.
excludedPackageTestA function used to exclude specific packages from the process. It is invoked with the packageName (string) of each package and should return true to exclude the package from the output.
fileDefault: oss-licenses.json. Specifies the path to the output file that will be generated. The path is relative to the bundle output directory.
unacceptableLicenseTestA function that defines unacceptable license identifiers. It is invoked with the license (string) of each package and should return true when the license is considered unacceptable, causing the build to fail.
includePrivateA boolean that determines whether private packages should be included in the output.
templateA function that customizes the generated file content. It accepts the packages array as an argument and should return the generated file content as a string.
bannerA string banner inserted at the beginning of the bundled file. Supports Lodash template format for dynamic content generation.

Example of default config

export const defaultOptions: DeepRequired<Options> = {
  banner: `/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */`,
  thirdParty: {
    includePrivate: false,
    excludedPackageTest: (packageName) => false,
    additionalFiles: {},
    unacceptableLicenseTest: (license) => false,
    output: {
      file: 'oss-licenses.json',
      // Template function that can be defined to customize report output
      template(dependencies) {
        // Default template function
      },
    }
  }
} as const

How to run this project

  1. Install newest pnpm with major version 7:
  npm install -g pnpm@7
  1. Install dependencies without lock file changes:
  pnpm install --frozen-lockfile
  1. Check if all commands work and tests pass:
  pnpm run build
  pnpm run dev
  pnpm run test

Keywords

FAQs

Package last updated on 19 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc