Node.js library for dependency license analysis of npm and Yarn projects. Uses the ClearlyDefined HTTP API to resolve licenses—no Java, no containers required.
- Pure Node.js: No Java/JAR—uses ClearlyDefined HTTP API
- npm & Yarn support: npm (
package-lock.json), Yarn v1, Yarn 3+ - SPDX-based license policy: Approves MIT, Apache-2.0, BSD, ISC, EPL-2.0, and more
- Use as library or CLI: Programmatic API and
npx @eclipse-che/license-toolcommand - Eclipse IP compliance: Optional JAR fallback for full IPLab/CQ integration
By default, this tool uses the ClearlyDefined HTTP API as its primary license data source. For full Eclipse IP Team compliance (CQ status, IPLab integration), use the --jar option to enable fallback to the official Eclipse Dash License Tool JAR, which queries the Eclipse Foundation's internal IP database.
| Package Manager | Lock File |
|---|---|
| npm | package-lock.json |
| Yarn v1 | yarn.lock (Yarn < 2) |
| Yarn 3+ | yarn.lock (Yarn >= 3) — parsed directly, no plugins required |
- Node.js >= 20.0.0
npm install @eclipse-che/license-tool
# or
yarn add @eclipse-che/license-toolThis library is available on npm.
You can find the published package here:
npm: @eclipse-che/license-tool
# Generate prod.md and dev.md in .deps/ (default)
npx @eclipse-che/license-tool
# Check only — fails if existing .deps files are outdated
npx @eclipse-che/license-tool --check
# Target a specific project directory
npx @eclipse-che/license-tool /path/to/project
# Tune batch size for ClearlyDefined API calls
npx @eclipse-che/license-tool --batch 200
# Auto-request harvest for unresolved dependencies
npx @eclipse-che/license-tool --harvest
# JAR fallback for unresolved dev dependencies
npx @eclipse-che/license-tool --jar /path/to/dash-licenses.jar| Option | Description | Default |
|---|---|---|
[projectPath] |
Path to project directory | current working directory |
--generate |
(Re)generate dependency files | default mode |
--check |
Check only, do not write any files | false |
--batch <n> |
Batch size for ClearlyDefined API requests | 500 |
--harvest |
Request harvest for unresolved deps from ClearlyDefined | false |
--jar <path> |
Path to Eclipse dash-licenses.jar for fallback on unresolved dev deps |
— |
--debug |
Copy tmp files for inspection | false |
--help |
Show help message | — |
The --jar option enables fallback to the official Eclipse Dash License Tool for unresolved dependencies.
Why use it? The Eclipse Dash JAR queries the Eclipse Foundation's internal IP database (IPLab), which contains additional approval data not available through the public ClearlyDefined API. This can resolve dependencies that appear as "restricted" or "unresolved" when using only the HTTP backend.
Requirements: Java 11 or higher must be installed.
Download:
# Download dash-licenses JAR (1.1.0)
curl -Lo dash-licenses.jar https://repo.eclipse.org/repository/dash-maven2/org/eclipse/dash/org.eclipse.dash.licenses/1.1.0/org.eclipse.dash.licenses-1.1.0.jarResources:
- Project page: https://projects.eclipse.org/projects/technology.dash
- Downloads: https://projects.eclipse.org/projects/technology.dash/downloads
How it works:
- Processes unresolved dev dependencies through the Eclipse IP database
- Adds newly approved items to
.deps/EXCLUDED/dev.md - Regenerates
dev.mdwith the updated approvals
Important: Once dependencies are added to the EXCLUDED files, you don't need to use --jar on every run. The EXCLUDED files act as a permanent cache of approved dependencies. Only re-run with --jar when you have new unresolved dev dependencies or want to refresh approvals from the Eclipse IP database.
The --harvest flag enables automatic harvest requests for unresolved dependencies through the ClearlyDefined API.
Why use it? When ClearlyDefined doesn't have license information for a package, you can request it to "harvest" the license data from the source repository. This process extracts license files and headers automatically.
How it works:
- For each unresolved dependency, check if it was already harvested (
GET /harvest/{coordinate}) - If not harvested, request a new harvest (
POST /harvest) - ClearlyDefined queues the harvest job (typically completes in minutes to hours)
- Re-run
npx @eclipse-che/license-toolafter harvest completes to pick up new license data
Example:
# Request harvest for unresolved dependencies
npx @eclipse-che/license-tool --harvest
# Wait for harvest to complete, then re-run
npx @eclipse-che/license-toolSee docs/harvest.md for detailed documentation.
import { generate } from '@eclipse-che/license-tool';
const result = await generate({
projectPath: '/path/to/project',
batchSize: 500,
check: false,
debug: false,
harvest: false,
jarPath: '/path/to/dash-licenses.jar', // optional
});
if (result.exitCode === 0) {
console.log('Licenses OK');
} else {
console.error(result.error);
}Generated in .deps/:
| File | Description |
|---|---|
prod.md |
Production dependencies |
dev.md |
Development dependencies |
problems.md |
Unresolved or restricted dependencies |
EXCLUDED/prod.md |
Manually excluded production deps |
EXCLUDED/dev.md |
Manually excluded dev deps |
| Option | Type | Default | Description |
|---|---|---|---|
projectPath |
string |
required | Path to project directory (must contain package.json and a lock file) |
batchSize |
number |
500 |
Batch size for ClearlyDefined API requests |
check |
boolean |
false |
Check only — do not write any files |
debug |
boolean |
false |
Copy tmp directory for inspection |
harvest |
boolean |
false |
Request harvest for unresolved dependencies from ClearlyDefined |
jarPath |
string |
— | Path to Eclipse dash-licenses.jar; runs JAR fallback for unresolved dev deps, adds approved items to EXCLUDED, and regenerates dev.md |
Returns Promise<{ exitCode: 0 | 1; error?: string }>.
@eclipse-che/license-tool/
├── src/
│ ├── library.ts # Main library API
│ ├── cli.ts # CLI entry point
│ ├── backends/ # License resolution (ClearlyDefined)
│ ├── document/ # Document generation
│ ├── helpers/ # Shared utilities
│ └── package-managers/ # npm, yarn, yarn3
├── dist/ # Built output
└── package.json
npm install
npm run build
npm test
npm run lint| Script | Description |
|---|---|
npm run build |
Compile TypeScript with webpack |
npm test |
Run all tests |
npm run test:unit |
Run unit tests only |
npm run test:e2e |
Run end-to-end tests |
npm run lint |
Run ESLint |
npm run header:check |
Check license headers |
npm run type-check |
TypeScript type check (no emit) |
- ClearlyDefined coverage: Newly published packages may not be indexed yet; use
--jaror--harvestto resolve them - Approval rules: Maintain
src/backends/license-policy.tsper Eclipse licenses as needed
- ClearlyDefined — License data source
- Eclipse Dash License Tool — Original Java tool
EPL-2.0