@damusix/dep-scanner
v1.0.0
Published
A tool for discovering dependencies recursively across package.json and common lock files, useful for finding vulnerabilities and package versions deeply nested in your projects
Maintainers
Readme
Dependency Scanner
A tool for discovering dependencies recursively across package.json and common lock files, useful for finding vulnerabilities and package versions deeply nested in your projects.
Features
- Search
pnpm-lock.yaml,yarn.lock,package-lock.json,npm-shrinkwrap.json, andpackage.jsonfiles recursively - Accept packages via a
-pcomma-separated argument or via file/stdin (-f file,-f -,--stdin) - Validate package names and basic semver versions; invalid lines are warned and ignored
- Works with piped input (e.g., clipboard via
pbpaste) and can be run from any root path with-r - Lightweight implementation using dynamic regex matching
- No external dependencies
Installation
Global Installation
Install globally using npm:
npm install -g @damusix/dep-scannerOr using pnpm:
pnpm add -g @damusix/dep-scannerOr using yarn:
yarn global add @damusix/dep-scannerRun without Installation
You can also run dep-scanner directly without installing it globally using npx:
npx dep-scanner -p express,lodashUsage
After installation, the dep-scanner command will be available globally.
Scan packages specified directly:
dep-scanner -p [email protected],lodash -r /path/to/repoScan packages from a file:
dep-scanner -f packages.txt -r /path/to/repoPipe clipboard or other stream into the scanner:
pbpaste | dep-scanner -f - -r /path/to/repo
pbpaste | dep-scanner --stdin -r /path/to/repoAuto-detect piped stdin (no -p or -f):
pbpaste | dep-scanner -r /path/to/repoScan current directory:
dep-scanner -p express,reactCommand Options
-p: Comma-separated packages (version optional). Example:-p [email protected],@scope/[email protected],pkg2-f: File with newline-separated entries, format:package=versionorpackage@version(version optional)-r: Root path to start searching from (defaults to current working directory)-h: Show help message
Examples
Finding a specific vulnerable package version:
dep-scanner -p [email protected] -r ~/projects/myappChecking multiple packages from a file:
Create a file vulnerable-packages.txt:
[email protected]
[email protected]
[email protected]Then run:
dep-scanner -f vulnerable-packages.txt -r ~/projectsQuick clipboard scan (macOS):
Copy a list of packages to clipboard, then:
pbpaste | dep-scanner --stdinNotes
- This tool uses dynamic regex matches and may produce false positives for unusual file formats
- It's intended for quick repository searches, not authoritative dependency resolution
- The tool searches through lock files and package.json without parsing them as JSON/YAML
Author
Danilo Alonso [email protected]
License
MIT
