dependency-radar 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # Dependency Radar
2
2
 
3
- Dependency Radar is a CLI tool that inspects a Node.js project’s installed dependencies and generates a single, human-readable HTML report. The report highlights dependency structure, usage, licences, vulnerabilities, and other signals that help you understand risk and complexity hidden in your node_modules folder.
3
+ Dependency Radar inspects your Node.js dependency graph and makes structural risk visible.
4
4
 
5
- The simplest way to get started is:
5
+ Unlike basic audit tools, it builds the graph from lockfiles, understands PNPM workspaces, validates declared vs inferred licences, and highlights structural risks before they become production problems.
6
+
7
+ No accounts. No uploads. Runs entirely on your machine.
8
+
9
+ The simplest way to get started is to go to your project root and run:
6
10
 
7
11
  ```bash
8
12
  npx dependency-radar
@@ -10,13 +14,36 @@ npx dependency-radar
10
14
 
11
15
  This runs a scan against the current project and writes a self-contained `dependency-radar.html` report you can open locally, share with teammates, or attach to tickets and documentation.
12
16
 
13
- ## What it does
17
+ ---
18
+
19
+ ![Dependency Radar – dependency list view](./docs/screenshot-01.jpg)
20
+ *List view: search, filter, and drill into every dependency — licence, vulnerabilities, install risk, depth, origins, and more.*
21
+
22
+ ![Dependency Radar – interactive dependency graph view](./docs/screenshot-02.jpg)
23
+ *Graph view: explore the full dependency tree visually, with direct, dev, and transitive relationships at a glance.*
14
24
 
15
- - Analyses installed dependencies from lockfiles first (`pnpm-lock.yaml`, `package-lock.json`/`npm-shrinkwrap.json`, `yarn.lock`), with package-manager CLI fallback when needed
16
- - Combines multiple signals (audit results, dependency graph data, import usage, and heuristics) into a single report
17
- - Shows direct vs transitive dependencies, dependency depth, and parent relationships
18
- - Highlights licences, known vulnerabilities, install-time scripts, native modules, and package footprint (including installed file counts)
19
- - Produces a single self-contained HTML file with no external assets, which you can easily share
25
+ ---
26
+
27
+ ## What you get
28
+
29
+ - **Vulnerability scanning** runs `npm audit` / `pnpm audit` / `yarn audit` and surfaces advisories with severity, fix availability, and reachability heuristics
30
+ - **Licence analysis** — validates SPDX declarations, infers licences from `LICENSE` files, and flags mismatches, unknown licences, and strong copyleft
31
+ - **Interactive dependency graph** — explore your full dependency tree visually, including direct, dev, and transitive relationships
32
+ - **Upgrade friction analysis** — identifies upgrade blockers: peer constraints, engine ranges, native bindings, install scripts, deprecated packages
33
+ - **Import usage heuristics** — classifies each dependency's runtime impact (`runtime`, `build`, `testing`, `tooling`, `mixed`) based on where it's imported in your source
34
+ - **Full transitive tree** — shows depth, parent relationships, fan-in/fan-out, and dependency origins
35
+ - **Workspace support** — works across npm, pnpm, and Yarn workspaces
36
+ - **CI-friendly** — `--fail-on` flag lets you enforce licence and vulnerability policies in pipelines
37
+ - **Completely offline-capable** — use `--offline` to skip registry calls; all package metadata is read from local `node_modules`
38
+ - **Single self-contained HTML file** — no server needed; open it locally, attach it to a ticket, or share it with your team
39
+
40
+ ## When should you use this?
41
+
42
+ - Before a release that requires licence review or compliance sign-off
43
+ - When assessing an unfamiliar codebase (for example during onboarding or due diligence before an acquisition)
44
+ - When evaluating a new framework or major dependency
45
+ - When you want CI guardrails via `--fail-on`
46
+ - When you need a portable HTML artifact for review, audit, or stakeholder discussion
20
47
 
21
48
  ## What it is not
22
49
 
@@ -25,16 +52,149 @@ This runs a scan against the current project and writes a self-contained `depend
25
52
  - Not a bundler or build tool
26
53
  - Not a dependency updater
27
54
 
55
+ ## Why this exists
56
+
57
+ Modern Node projects pull in hundreds (or thousands) of transitive dependencies, and most of the risk is structural, not obvious.
58
+
59
+ - `npm audit` tells you about known vulnerabilities, but it does not explain how a dependency got there, whether it is reachable at runtime, or how deep it sits in your graph.
60
+ - Licence tooling often trusts `package.json` declarations, even though they can be missing, invalid, or wrong, and rarely checks what is actually in the installed `LICENSE` file.
61
+ - Monorepos and PNPM workspaces make the tree harder to reason about, especially when package manager outputs include optional platform variants that are not installed on your machine.
62
+ - Upgrade pain usually shows up late, when a Node major bump or a package update breaks due to peer dependency constraints, engine ranges, native bindings, or install scripts.
63
+
64
+ Dependency Radar exists to make those hidden signals visible in one place, from the dependencies you actually have installed, with a single report you can review, share, and use to set practical CI guardrails.
65
+
28
66
  ---
29
67
 
30
- For teams that want deeper analysis, long-term tracking, and additional enrichment (such as ecosystem and maintenance signals), Dependency Radar also offers an optional premium service.
68
+ ## Need to share findings with leadership?
69
+
70
+ The CLI tool is free and fully functional forever.
71
+
72
+ If you need to communicate dependency risk beyond engineering (CTO, compliance, security, clients, or investors), the optional premium service adds executive summaries, presentation-ready reports, and deeper enrichment signals that are not available in the standard local scan.
73
+
74
+ These include ecosystem and maintenance insights such as whether a dependency is archived, deprecated upstream, actively maintained, or showing signs of stagnation, helping you prioritise risk in larger portfolios or during technical due diligence.
75
+
31
76
  See https://dependency-radar.com for details.
32
77
 
78
+ ---
79
+
80
+ ## Usage
81
+
82
+ Run a scan against the current project (writes `dependency-radar.html`):
83
+
84
+ ```bash
85
+ npx dependency-radar
86
+ ```
87
+
88
+ The `scan` command is the default and can also be run explicitly as `npx dependency-radar scan`.
89
+
90
+ **Options:**
91
+
92
+ | Flag | Description |
93
+ |---|---|
94
+ | `--project <path>` | Path to the project to scan (defaults to current directory) |
95
+ | `--out <path>` | Output path for the report file |
96
+ | `--offline` | Skip `npm audit` and `npm outdated` (useful for offline/air-gapped scans) |
97
+ | `--json` | Output JSON instead of HTML (`dependency-radar.json`) |
98
+ | `--no-report` | Run analysis only; no HTML/JSON output written |
99
+ | `--keep-temp` | Keep the temporary `.dependency-radar/` folder for debugging |
100
+ | `--open` | Open the generated report using the system default browser |
101
+ | `--fail-on <rules>` | Fail with exit code 1 when selected policy rules are violated (see below) |
102
+ | `--help` | Show all options |
103
+
104
+ ### CI policy enforcement (`--fail-on`)
105
+
106
+ ```
107
+ npx dependency-radar --fail-on reachable-vuln,licence-mismatch
108
+ ```
109
+
110
+ Supported rules:
111
+
112
+ | Rule | Description |
113
+ |---|---|
114
+ | `reachable-vuln` | Fail if at least one reachable runtime vulnerability is present |
115
+ | `production-vuln` | Fail if at least one runtime vulnerability is present (reachability ignored) |
116
+ | `high-severity-vuln` | Fail if at least one high/critical vulnerability is present |
117
+ | `licence-mismatch` | Fail if at least one dependency has a declared-vs-inferred licence mismatch |
118
+ | `copyleft-detected` | Fail if strong copyleft (GPL/AGPL) appears in runtime dependencies |
119
+ | `unknown-licence` | Fail if at least one dependency has neither declared nor inferred licence data |
120
+
121
+ When rules are violated, Dependency Radar prints `✖ Policy violations detected:` and exits `1`. Unknown rules also exit `1` with a clear error message.
122
+
123
+ ### Example: open the generated report using the system default:
124
+
125
+ ```bash
126
+ npx dependency-radar --open
127
+ ```
128
+
129
+ ### Example: specify project and output path
130
+
131
+ ```
132
+ npx dependency-radar --project ./my-app --out ./reports/dependency-radar.html
133
+ ```
134
+
135
+ ### Example: keep temp files for debugging
136
+ ```bash
137
+ npx dependency-radar --keep-temp
138
+ ```
139
+
140
+ ### Example: skip `npm audit` and `npm outdated` (useful for offline scans):
141
+
142
+ ```bash
143
+ npx dependency-radar --offline
144
+ ```
145
+
146
+ ### Example: don't create report and fail the command in CI when selected policy rules are violated:
147
+
148
+ ```bash
149
+ npx dependency-radar --no-report --fail-on reachable-vuln,licence-mismatch
150
+ ```
151
+
152
+ __Note:__ When used with `--no-report`, the `--keep-temp` flag is ignored.
153
+ Temporary files are normally deleted automatically.
154
+ If you intentionally use `--keep-temp` (without `--no-report`) for debugging,
155
+ the `.dependency-radar/` folder may contain dependency metadata and should not be committed.
156
+
157
+ ### CLI summary
158
+
159
+ At the end of each scan, the CLI prints a summary block with high-level counts, for example:
160
+
161
+ ```text
162
+ Summary:
163
+ • Direct deps scanned: 8
164
+ • Transitive deps scanned: 65
165
+ • Vulnerable packages: 5 (1 reachable)
166
+ • Unused installed deps: 0
167
+ • Licence mismatches: 3
168
+ • Major upgrade blockers: 28
169
+ - 14 strict peer dependency constraints
170
+ - 6 narrow engine ranges
171
+ - 4 deprecated packages
172
+ - 4 native bindings
173
+ ```
174
+
175
+ The blocker detail counts can overlap: a single package may contribute to multiple blocker categories.
176
+
177
+
178
+ ## Package Manager Support
179
+
180
+ | Package Manager | Dependency Tree | Audit | Outdated | Workspaces |
181
+ |---|---|---|---|---|
182
+ | npm | ✅ Lockfile-first (`package-lock.json` / `npm-shrinkwrap.json`) | ✅ | ✅ | ✅ |
183
+ | pnpm | ✅ Lockfile-first (`pnpm-lock.yaml`) | ✅ | ✅ | ✅ |
184
+ | Yarn Classic (v1) | ✅ Lockfile-first (`yarn.lock`) | ✅ | ✅ | ✅ |
185
+ | Yarn Berry (v2+, node-modules linker) | ✅ Lockfile-first (`yarn.lock`) | ✅ | ⚠️ Plugin-dependent | ✅ |
186
+ | Yarn Plug'n'Play | ❌ Not yet supported | | | |
187
+
188
+ ## Requirements
189
+
190
+ - Node.js 14.14+
191
+ - Dependencies must be installed (`npm install` / `pnpm install` / `yarn install`) before scanning
192
+
33
193
  ## How a scan works
34
194
 
35
195
  When you run `npx dependency-radar` (or `dependency-radar scan`), the CLI executes this pipeline:
36
196
 
37
- 1. Parse CLI options (`--project`, `--out`, `--offline`, `--json`, `--keep-temp`, `--open`).
197
+ 1. Parse CLI options (`--project`, `--out`, `--offline`, `--json`, `--no-report`, `--keep-temp`, `--open`, `--fail-on`).
38
198
  2. Detect workspace/package-manager context:
39
199
  - Workspace roots from `pnpm-workspace.yaml` or `package.json#workspaces`
40
200
  - Dependency policy from `package.json` and `pnpm-workspace.yaml` overrides/resolutions
@@ -44,7 +204,7 @@ When you run `npx dependency-radar` (or `dependency-radar scan`), the CLI execut
44
204
  4. For each workspace package (or just the project root in single-package mode), collect dependency graph data:
45
205
  - Lockfile-first graph parsing (`pnpm-lock.yaml`, `npm-shrinkwrap.json`/`package-lock.json`, `yarn.lock`)
46
206
  - Fallback to package-manager tree commands (`npm ls` / `pnpm list` / `yarn list`) only when lockfile parsing is unavailable
47
- - PNPM CLI fallback keeps depth retries for very large trees
207
+ - PNPM CLI fallback retries with reduced depth for very large trees
48
208
  5. Run additional collectors:
49
209
  - Vulnerabilities (`npm audit` / `pnpm audit` / `yarn audit` or `yarn npm audit`)
50
210
  - Version drift (`npm outdated` / `pnpm outdated` / `yarn outdated`, where available)
@@ -86,7 +246,7 @@ The scan is local-first: package metadata is read from `node_modules`; only audi
86
246
  - Dependency Radar uses `pnpm-lock.yaml` as the primary graph source and only falls back to `pnpm list` when needed, reducing OOM/string-length failures on large workspaces.
87
247
  - Result: reports now reflect only dependencies that actually exist on disk and can be inspected locally.
88
248
 
89
- ## Usage Heuristics (`usage.runtimeImpact` and `usage.introduction`)
249
+ ### Usage Heuristics (`usage.runtimeImpact` and `usage.introduction`)
90
250
 
91
251
  These two fields are inferred from local signals. They are intended as review hints, not strict truth.
92
252
 
@@ -126,7 +286,7 @@ These two fields are inferred from local signals. They are intended as review hi
126
286
  - Not valid as a definitive runtime/ownership model.
127
287
  - Accuracy depends on file naming conventions, static import detectability, and dependency graph quality from package manager output.
128
288
 
129
- ## Upgrade Blockers Heuristic (`upgrade.blockers`, `upgrade.blocksNodeMajor`)
289
+ ### Upgrade Blockers Heuristic (`upgrade.blockers`, `upgrade.blocksNodeMajor`)
130
290
 
131
291
  `upgrade.blockers` is a local, static heuristic for upgrade friction. It does not run package code and does not query external APIs.
132
292
 
@@ -172,112 +332,7 @@ This logic applies to all dependencies (direct and transitive). Inferred license
172
332
  In the HTML report, the License badge shows a trailing `*` when status is `mismatch`.
173
333
  When a dependency repository resolves to GitHub, the expanded License section links to `package.json` and `LICENSE` source files for faster verification.
174
334
 
175
-
176
- ## Setup
177
-
178
- ```bash
179
- npm install
180
- npm run build
181
- ```
182
-
183
- ## Requirements
184
-
185
- - Node.js 14.14+
186
-
187
- ## Usage
188
-
189
- The simplest way to run Dependency Radar is via npx. It runs in the current directory and writes an HTML report to disk.
190
-
191
- Run a scan against the current project (writes `dependency-radar.html`):
192
-
193
- ```bash
194
- npx dependency-radar
195
- ```
196
-
197
- The `scan` command is the default and can also be run explicitly as `npx dependency-radar scan`.
198
-
199
-
200
- Specify a project and output path:
201
-
202
- ```bash
203
- npx dependency-radar --project ./my-app --out ./reports/dependency-radar.html
204
- ```
205
-
206
- Keep the temporary `.dependency-radar` folder for debugging raw tool outputs:
207
-
208
- ```bash
209
- npx dependency-radar --keep-temp
210
- ```
211
-
212
- Skip `npm audit` and `npm outdated` (useful for offline scans):
213
-
214
- ```bash
215
- npx dependency-radar --offline
216
- ```
217
-
218
- Output JSON instead of HTML report:
219
-
220
- ```bash
221
- npx dependency-radar --json
222
- ```
223
-
224
- Open the generated report using the system default:
225
-
226
- ```bash
227
- npx dependency-radar --open
228
- ```
229
-
230
- Show options:
231
-
232
- ```bash
233
- npx dependency-radar --help
234
- ```
235
-
236
- ## Package Manager Support
237
-
238
- - npm: Supported for lockfile-first dependency tree (`npm-shrinkwrap.json` or `package-lock.json`), audit, outdated, single-package, and workspaces.
239
- - pnpm: Supported for lockfile-first dependency tree (`pnpm-lock.yaml`), audit, outdated, and workspaces (with `pnpm list` fallback depth retries when required).
240
- - Yarn Classic (v1, node_modules linker): Supported for lockfile-first dependency tree (`yarn.lock`), audit, outdated, and workspaces.
241
- - Yarn Berry (v2+, node-modules linker): Supported for lockfile-first dependency tree (`yarn.lock`) and audit; outdated support depends on available Yarn commands/plugins and may be unavailable.
242
- - Yarn Plug'n'Play (`nodeLinker: pnp`): Not supported yet.
243
-
244
- ## Scripts
245
-
246
- - `npm run build` – generate SPDX/report assets and compile TypeScript to `dist/`
247
- - `npm run dev` – run a scan from source (`ts-node src/cli.ts scan`)
248
- - `npm run scan` – run a scan from the built output (`node dist/cli.js scan`)
249
- - `npm run dev:report` – run the report UI dev server
250
- - `npm run build:spdx` – rebuild bundled SPDX identifiers
251
- - `npm run build:report-ui` – build report UI assets
252
- - `npm run build:report` – rebuild report assets used by the CLI
253
-
254
- ### Test scripts:
255
-
256
- - `npm run test:unit` – run Vitest unit tests
257
- - `npm run test:unit:watch` – watch mode for fast local iteration
258
- - `npm run test:fixtures` – run curated fixture integration tests (mostly offline scans)
259
- - `npm run test:fixtures:online` – run online fixture checks (audit/outdated regression coverage)
260
- - `npm run test:fixtures:all` – run all fixture integration tests
261
- - `npm run test:release` – full pre-release gate (`build` + unit + fixture + package dry run)
262
-
263
- Fixture orchestration lives in `/test-fixtures/package.json` with helper scripts under `/test-fixtures/scripts`.
264
-
265
- ## Notes
266
-
267
- - The target project must have dependencies installed (run `npm install`, `pnpm install`, or `yarn install` first).
268
- - The scan runs on your machine and does not upload your code or dependencies anywhere.
269
- - `npm audit`/`pnpm audit`/`yarn npm audit` and `npm outdated`/`pnpm outdated` perform registry lookups; use `--offline` for offline-only scans.
270
- - On some Yarn Berry setups, `yarn outdated` is not available; the scan continues and marks outdated data as unavailable.
271
- - A temporary `.dependency-radar` folder is created during the scan to store intermediate tool output.
272
- - Use `--keep-temp` to retain this folder for debugging; otherwise it is deleted automatically.
273
- - If some per-package tools fail (common in large workspaces), the scan continues and reports warnings; missing sections are marked unavailable where applicable.
274
-
275
- ## Output
276
-
277
- Dependency Radar writes a single HTML file (dependency-radar.html by default).
278
- The file is fully self-contained and can be opened locally in a browser, shared with others, or attached to tickets and documentation.
279
-
280
- ### JSON output
335
+ ## JSON output
281
336
 
282
337
  Use `--json` to write the aggregated scan data as JSON (defaults to `dependency-radar.json`).
283
338
 
@@ -484,8 +539,48 @@ For full details and any future changes, see `src/types.ts`.
484
539
  Environment data includes Node.js version, OS platform, CPU architecture, and package manager versions.
485
540
  No personal information, usernames, paths, or environment variables are collected.
486
541
 
542
+ ## Notes
543
+
544
+ - The target project must have dependencies installed (run `npm install`, `pnpm install`, or `yarn install` first).
545
+ - The scan runs on your machine and does not upload your code or dependencies anywhere.
546
+ - `npm audit`, `pnpm audit`, `yarn npm audit` and their corresponding `outdated` commands perform registry lookups; use `--offline` for offline-only scans.
547
+ - On some Yarn Berry setups, `yarn outdated` is not available; the scan continues and marks outdated data as unavailable.
548
+ - A temporary `.dependency-radar/` folder is created during the scan to store intermediate tool output.
549
+ - Use `--keep-temp` to retain this folder for debugging; otherwise it is deleted automatically.
550
+ - If some per-package tools fail (common in large workspaces), the scan continues and reports warnings; missing sections are marked unavailable where applicable.
551
+
552
+ ---
553
+
487
554
  ## Development
488
555
 
556
+ ### Setup
557
+
558
+ ```bash
559
+ npm install
560
+ npm run build
561
+ ```
562
+
563
+ ### Scripts
564
+
565
+ | Script | Description |
566
+ |---|---|
567
+ | `npm run build` | Generate SPDX/report assets and compile TypeScript to `dist/` |
568
+ | `npm run dev` | Run a scan from source (`ts-node src/cli.ts scan`) |
569
+ | `npm run scan` | Run a scan from the built output (`node dist/cli.js scan`) |
570
+ | `npm run dev:report` | Run the report UI dev server |
571
+ | `npm run build:spdx` | Rebuild bundled SPDX identifiers |
572
+ | `npm run build:report-ui` | Build report UI assets |
573
+ | `npm run build:report` | Rebuild report assets used by the CLI |
574
+ | `npm run test:unit` | Run Vitest unit tests |
575
+ | `npm run test:unit:watch` | Watch mode for fast local iteration |
576
+ | `npm run test:fixtures` | Run curated fixture integration tests (mostly offline scans) |
577
+ | `npm run test:fixtures:online` | Run online fixture checks (audit/outdated regression coverage) |
578
+ | `npm run test:fixtures:all` | Run all fixture integration tests |
579
+ | `npm run test:release` | Full pre-release gate (`build` + unit + fixture + package dry run) |
580
+
581
+
582
+ Fixture orchestration lives in `/test-fixtures/package.json` with helper scripts under `/test-fixtures/scripts`.
583
+
489
584
  ### Report UI Development
490
585
 
491
586
  The HTML report UI is developed in a separate Vite project located in `report-ui/`. This provides a proper development environment with hot reload, TypeScript support, and sample data.