npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

forcedep

v1.0.1

Published

Salesforce dependency analysis CLI

Downloads

263

Readme

ForceDep

Salesforce dependency analysis CLI

ForceDep helps Salesforce developers understand what a component references and which components reference it, without manually searching through the entire codebase. It analyzes relationships between Salesforce components and provides recursive dependency trees and impact analysis.

ForceDep currently supports dependency analysis across:

  • Apex Classes
  • Apex Triggers
  • Lightning Web Components (LWC)
  • Salesforce Flows

Supported relationships include:

  • Apex → Apex
  • Trigger → Apex
  • LWC → Apex
  • Flow → Apex
  • Flow → Flow

Features

  • Apex dependency tracing
  • Trigger → Apex dependency analysis
  • LWC → Apex dependency analysis
  • Flow → Apex dependency analysis
  • Flow → Flow dependency analysis
  • Recursive dependency trees
  • Circular dependency detection
  • Impact analysis
  • Component filtering
  • Apex category filtering
  • Test-class inclusion
  • Smart component name suggestions
  • Performance-optimized dependency parsing

Installation

Install ForceDep globally via npm:

npm install -g forcedep

Verify your installation:

fdp --version

Example output:

ForceDep v1.0.0

Salesforce dependency analysis CLI
License: GPL-3.0-or-later
Developed by: Akshay Khairnar

Basic Usage

Important: Local Metadata Required

ForceDep analyzes Salesforce metadata available in your local project. You must retrieve or sync the relevant Salesforce metadata to your local machine before running a trace.

For example:

fdp trace AccountTriggerHelper

For accurate dependency results, your local project directory must contain the actual files that ForceDep needs to analyze.

ForceDep v1 analyzes local Salesforce metadata. It does not currently retrieve metadata directly from a connected Salesforce org.

To trace the immediate dependencies of a component, use the trace command:

fdp trace <component>

Example:

fdp trace AccountTriggerHelper

By default, trace shows the immediate dependency context (depth of 1) of the target component rather than recursively expanding the entire dependency graph.

Terminology:

  • Referenced By: Components that reference the target component.
  • References: Components that the target component references.

Example output:

🌳 Apex: AccountTriggerHelper

├── Referenced By
│   ├── Trigger: AccountTrigger
│   ├── Apex: AccountTriggerHandler
│   └── Flow: Evaluate_Account_Documents
│
└── References
    ├── Apex: NightlySyncBatch
    └── Apex: AccountServiceController

Trace Options

| Option | Description | | --- | --- | | --include tests | Include Apex test classes in the trace | | --exclude triggers | Exclude Apex triggers | | --exclude lwc | Exclude Lightning Web Components | | --exclude flows | Exclude Salesforce Flows | | --only <category> | Only include Apex classes of a specific category | | --sametype | Only trace dependencies of the same component type | | --all | Show the full recursive dependency tree | | --impact | Generate an impact analysis report instead of a tree |

--only Categories

The --only option filters Apex classes by their detected architecture/category. Note that this applies only to Apex classes, not Triggers, LWCs, or Flows.

Supported categories:

  • queueable: fdp trace AccountTriggerHelper --only queueable
  • schedulable: fdp trace AccountTriggerHelper --only schedulable
  • utility: fdp trace AccountTriggerHelper --only utility
  • wrapper: fdp trace AccountTriggerHelper --only wrapper
  • trigger-handler: fdp trace AccountTriggerHelper --only trigger-handler

Include / Exclude Examples

Filter specific component types from your trace:

# Include test classes in the tree (excluded by default)
fdp trace AccountTriggerHelper --include tests

# Remove triggers from the trace output
fdp trace AccountTriggerHelper --exclude triggers

# Remove Lightning Web Components from the trace output
fdp trace AccountTriggerHelper --exclude lwc

# Remove Salesforce Flows from the trace output
fdp trace AccountTriggerHelper --exclude flows

Combined Commands

ForceDep supports combining options for highly specific queries:

# Exclude both Triggers and LWCs
fdp trace AccountTriggerHelper --exclude triggers --exclude lwc

# Exclude Triggers, LWCs, and Flows
fdp trace AccountTriggerHelper --exclude triggers --exclude lwc --exclude flows

# See the impact analysis without factoring in flows
fdp trace AccountTriggerHelper --exclude flows --impact

# Only see wrapper classes that match the root component's type (Apex)
fdp trace AccountTriggerHelper --sametype --only wrapper

# View wrapper classes of the same type, including test classes
fdp trace AccountTriggerHelper --sametype --only wrapper --include tests

# View the full recursive tree, but hide all UI and trigger components
fdp trace AccountTriggerHelper --all --exclude triggers --exclude lwc

Recursive Trace

To view the complete, multi-level dependency tree:

fdp trace AccountTriggerHelper --all

The default trace only shows immediate neighbors. --all recursively traverses reachable dependencies and dependents. Circular dependencies are safely detected and displayed instead of causing infinite traversal.

Impact Analysis

Impact Analysis provides a compact numerical view of the reachable dependency impact instead of printing the full dependency tree.

fdp trace AccountTriggerHelper --impact

Example Output:

Impact Analysis

Component
─────────
Apex: AccountTriggerHelper

Impact
──────
Affected Components   : 48
Dependency Depth      : 12
Circular Dependencies : 0

Component Types
───────────────
Apex Classes : 40
Triggers     : 3
Flows        : 1
LWCs         : 4

Apex Categories
───────────────
Helpers      : 6
Controllers  : 6
Queueables   : 5
Batches      : 6

(Note: These numbers are examples and will vary based on your specific Salesforce project.)

Same Type

ForceDep detects the root component's type and can restrict the trace exclusively to components of that same type.

Apex Example:

fdp trace AccountTriggerHelper --sametype

Flow Example:

fdp trace Evaluate_Account_Documents --sametype

Flow Example

Flow components can be traced just like Apex classes:

fdp trace Evaluate_Account_Documents

To see recursive flow dependencies:

fdp trace Evaluate_Account_Documents --all

The Flow dependency parser detects supported Apex actions and Subflow relationships directly from the XML metadata.

Global Help and Version

Global Options:

  • fdp --help or fdp -h : Display the main ForceDep CLI help, including available commands.
  • fdp --version or fdp -V : Display the current ForceDep version, license, and author.

Command-specific help:

  • fdp trace --help : Display the options and examples specific to the trace command.

Supported Components

| Component | Supported | | --- | --- | | Apex Classes | Yes | | Apex Triggers | Yes | | Lightning Web Components | Yes | | Salesforce Flows | Yes |

Performance

ForceDep performs project-wide dependency analysis and uses optimized dependency parsing along with concurrent file I/O to keep tracing responsive on larger Salesforce projects.

License

ForceDep is licensed under the GNU General Public License v3.0 or later (GPL-3.0-or-later).

Author

Developed by Akshay Khairnar.