File collection
Source: src/engine/file-collector.ts
Globs the project directory for TypeScript files matching the include and exclude patterns from the config. Only user source files should be analyzed, so test files, generated code, declaration files, and dependencies are left out. That avoids false positives and keeps scans fast.
Input is the directory to glob and the resolved config:
targetPath: string // directory to glob
config: NestjsDoctorConfig // include/exclude patternsThe result is a sorted list of absolute paths:
string[] // sorted array of absolute file pathsFor monorepos, the result is keyed by sub-project:
Map<string, string[]> // project name → sorted file pathsHow it works
Uses tinyglobby to match files:
- Reads
config.includepatterns (default:["**/*.ts"]) - Reads
config.excludepatterns (defaults plus user additions) - Runs the glob from
targetPath - Returns results sorted alphabetically for deterministic output
For monorepos, collectMonorepoFiles calls collectFiles once per sub-project using each project's root path. All sub-project globs run in parallel via Promise.all.
Debugging tips
- If files are missing from the scan, check that the file matches an
includepattern and does not match anexcludepattern. The defaults exclude test files, mocks, and seeders. - Run with
--verboseto see which files were scanned. The file count is shown in the report. - The glob is relative to the target path. Absolute patterns are not supported.