npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@transmission-dynamics/esbuild-plugin-license

v1.0.1

Published

Manage third-party license compliance in your esbuild

Downloads

13

Readme

@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:

| Name | Description | | :---------------------- | :------------------------------------------------------------------------------------------------------------------------- | | additionalFiles | Default: {}. 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>. | | excludedPackageTest| A 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. | | file | Default: oss-licenses.json. Specifies the path to the output file that will be generated. The path is relative to the bundle output directory. | | unacceptableLicenseTest | A 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. | | includePrivate | A boolean that determines whether private packages should be included in the output. | | template | A 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. | | banner | A 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