# pnpm-cdx

> Generate a CycloneDX SBOM from a PNPM Node.js project.

Latest version **1.0.3** (published 2022-10-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install pnpm-cdx
pnpm add pnpm-cdx
yarn add pnpm-cdx
bun add pnpm-cdx
```

Provides the command `pnpm-cdx`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-10-07 |
| First published | 2022-10-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 18.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Benjamin Babik |
| Maintainers | benbenbenbenbenben |
| Keywords | SBOM, SPDX, cyclonedx, BOM |

## Links

- npm: https://www.npmjs.com/package/pnpm-cdx
- Repository: https://github.com/benbenbenbenbenben/pnpm-cdx
- Issues: https://github.com/benbenbenbenbenben/pnpm-cdx/issues
- npm.io page: https://npm.io/package/pnpm-cdx

## Recent versions

- 1.0.3 (latest) — 2022-10-07
- 1.0.2 — 2022-10-07
- 1.0.1 — 2022-10-07
- 1.0.0 — 2022-10-07

## README

# pnpm-cdx

Generate a CycloneDX SBOM from a PNPM Node.js project.

> ⚠️ pnpm-cdx is alpha, it generate license reports for GitLab CI. CycloneDX format is work in progress. ⚠️

# Installing

The pnpm-cdx package includes both a CLI and a library with commonjs and esm entrypoints. Installation is as you would expect:

**With pnpm:**
```bash
pnpm add pnpm-cdx
```

**With yarn:**
```bash
yarn add pnpm-cdx
```

**With npm:**
```bash
npm i pnpm-cdx
```

## Using in CI

Typically in CI scenarios, you may prefer to install pnpm-cdx globally with your package managers global flag (usually `-g`), as in this contrived example adapted from this repository's [Earthly](https://earthly.dev/) [Earthfile](/Earthfile):

```earthly
validate:
    FROM node:16-bullseye
    WORKDIR /app
    RUN npm i pnpm-cdx -g
    RUN pnpm-cdx gitlab -o gl-license-report.json
    SAVE ARTIFACT gl-license-report.json
```

# Usage

```typescript
import { analyseProject } from "pnpm-cdx";

(async () => {
    // analyze *this* project
    const analysis = await analyseProject(".")
    // generate gitlab compatible license report
    const report = await analysis.generateReport({
        format: "gitlab-license-report-2.1",
    })
    // pretty print the report
    console.log(JSON.stringify(report, null, 2))
})()
```

---
_Source: https://npm.io/package/pnpm-cdx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
