Skip to main content
The lines-of-code command counts effective lines of code in your project, excluding comments and blank lines. This provides an accurate measure of your codebase size.

Usage

rev-dep lines-of-code [flags]

Flags

--cwd
string
default:"$PWD"
Directory to analyze
-h, --help
boolean
Display help for the lines-of-code command

Examples

Count lines of code in current directory

rev-dep lines-of-code
This will analyze all source files in the current working directory and count the effective lines of code.

Count lines in a specific directory

rev-dep lines-of-code --cwd ./src
Analyze only the src directory to get lines of code for your source files.

Count lines in a monorepo package

rev-dep lines-of-code --cwd ./packages/api
Get line count for a specific package in a monorepo.

How it works

The lines-of-code command:
  1. Scans source files - Recursively finds all JavaScript and TypeScript files
  2. Excludes noise - Ignores comments (single-line and multi-line) and blank lines
  3. Counts effective code - Returns the count of actual code lines
Only source code files are counted. Comments, blank lines, and non-code files are excluded from the count.

Use cases

  • Project sizing - Understand the actual size of your codebase
  • Technical debt tracking - Monitor codebase growth over time
  • Team metrics - Compare sizes across different parts of a monorepo
  • Benchmarking - Compare with other tools (Rev-dep can analyze 500k+ LoC in ~500ms)

Build docs developers (and LLMs) love