Dependency License Check

Reads each new dependency's SPDX license against your policy, so a GPL, unlicensed or relicensed package doesn't slip into your project.

StopsGPL dependency shipped in closed source

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/dependency-license-check.json

The files land in your project. They're yours to edit.

Usage

dependency-license-check-usage.tsx
import { DependencyLicenseCheck, type DependencyInfo } from "@/components/ui/dependency-license-check"

<DependencyLicenseCheck
  defaultValue={incoming}
  policy={{ project: "proprietary", distribution: "distributed" }}
  onAdd={(deps) => setAdded(deps.map((d) => `${d.name}@${d.version}`).join(", "))}
/>

What it catches

  • Copyleft (GPL, AGPL) licenses in closed-source projects
  • Missing or unrecognised licenses
  • Source-available terms (e.g. BSL, SSPL) in a hosted product
  • Packages on your deny list
  • A license change between versions, with an option to stay on the older version

Props

DependencyLicenseCheck props
PropTypeDefault
value

Controlled dependencies being added.

DependencyInfo[]—
defaultValue

Initial dependencies when uncontrolled.

DependencyInfo[][]
onValueChange

Called after Remove or "Stay on" with the new list.

(dependencies: DependencyInfo[]) => void—
policy

Your project's license, distribution and allow/deny lists.

LicensePolicy{}
onAdd

Called on Add. With problems left, the first click jumps to them and the second adds. May return a Promise.

(dependencies: DependencyInfo[]) => void | Promise<void>—
messages

Any visible string; `reasons`, `categories` and `policy` may be partial.

Partial<Omit<DependencyLicenseMessages, "reasons" | "categories" | "policy">> & { reasons?: Partial<DependencyLicenseMessages["reasons"]>…—

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

Accessibility

  • License categories are written in text, not just chip colour
  • Focus moves to the first fix, or the add button when clear
  • Package names show the version in a title

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

This is a UX guard rail. Enforce on the server: Enforce license policy in CI (lockfile scan) so dependencies added outside this UI are caught too.

  • Uses the license metadata you pass; packages sometimes declare a license that differs from their files
  • Doesn't scan transitive dependencies unless you pass them
  • Not legal advice: your policy decides what is allowed

What it stops

GPL dependency shipped in closed source

Also known as

license · spdx · npm install · dependencies · open source compliance · gpl · mit · package.json

Field type

Dependencies

Pairs well with