Skip to main content

Description

Analyzes your code to identify which npm packages are actually being used. Helps keep track of your project’s runtime dependencies.

Usage

rev-dep node-modules used [flags]

Examples

# Analyze from a specific entry point and group by module
rev-dep node-modules used -p src/index.ts --group-by-module

# Count used modules
rev-dep node-modules used --count

# Show files using each module
rev-dep node-modules used --group-by-module-files-count

# Analyze multiple entry points
rev-dep node-modules used -p src/index.ts -p src/server.ts

Flags

--condition-names
strings
List of conditions for package.json imports resolution (e.g. node, imports, default)
-n, --count
boolean
Only display the count of modules
-c, --cwd
string
default:"$PWD"
Working directory for the command
-p, --entry-points
strings
Entry point file(s) to start analysis from (default: auto-detected)
-e, --exclude-modules
strings
List of modules to exclude from the output
-b, --files-with-binaries
strings
Additional files to search for binary usages. Use paths relative to cwd
-m, --files-with-node-modules
strings
Additional files to search for module imports. Use paths relative to cwd
--follow-monorepo-packages
strings
Enable resolution of imports from monorepo workspace packages. Pass without value to follow all, or pass package names
--group-by-entry-point
boolean
Organize output by entry point file path
--group-by-entry-point-modules-count
boolean
Organize output by entry point and show count of unique modules
--group-by-file
boolean
Organize output by project file path
--group-by-module
boolean
Organize output by npm package name
--group-by-module-entry-points-count
boolean
Organize output by npm package name and show count of entry points using it
--group-by-module-files-count
boolean
Organize output by npm package name and show count of files using it
--group-by-module-show-entry-points
boolean
Organize output by npm package name and list entry points using it
-h, --help
boolean
Help for used
-t, --ignore-type-imports
boolean
Exclude type imports from the analysis
-i, --include-modules
strings
List of modules to include in the output
--package-json
string
default:"./package.json"
Path to package.json
--pkg-fields-with-binaries
strings
Additional package.json fields to check for binary usages
--tsconfig-json
string
default:"./tsconfig.json"
Path to tsconfig.json
-v, --verbose
boolean
Show warnings and verbose output

Use Cases

Track Runtime Dependencies

Identify which npm packages are actually being used in your codebase to maintain an accurate dependency list.

Monorepo Analysis

Use --follow-monorepo-packages to analyze dependencies across workspace packages.

Entry Point Analysis

Group by entry points to see which dependencies are used by different parts of your application.

Build docs developers (and LLMs) love