dep_audit 0.1.9
dep_audit: ^0.1.9 copied to clipboard
A Dart and Flutter dependency audit tool that identifies outdated packages and security vulnerabilities.
dep_audit #
A powerful, lightweight dependency and package health auditor for Dart & Flutter projects. dep_audit
scans your pubspec.yaml
and source code to create a clear, actionable report on your project's dependencies.
๐ฏ Perfect pub.dev Score: Rated 160/160 points with full WASM compatibility
๐ Table of Contents #
- โจ Features
- ๐ฆ Installation
- ๐ Usage
- ๐ก Examples
- โ๏ธ Configuration
- ๐ค Contributing
- ๐ License
- ๐ Changelog
โจ Features #
- ๐ Outdated Dependencies: Compares your locked versions against the latest on pub.dev
- ๐งน Unused Dependencies: Scans your code for
import
statements to find dependencies that are declared but never used - โ ๏ธ Abandoned Packages: Checks package metadata for discontinued flags or long periods of inactivity (
stale
) - ๐ง Safe Auto-Fixing: Automatically run safe fixes with a
--fix
flag to remove unused packages and upgrade outdated ones - ๐ Multiple Report Formats: Output reports in human-readable text or machine-readable JSON for CI/CD pipelines
- ๐ Cross-Platform: Works on Linux, macOS, Windows, and Web (WASM compatible)
- โก Fast & Lightweight: Minimal dependencies, maximum performance
- ๐ฏ CI/CD Ready: Perfect for automated workflows and quality gates
๐ฆ Installation #
Global Installation (Recommended) #
Install once globally to use across all your projects:
dart pub global activate dep_audit
Project-Specific Installation #
Add as a dev dependency for team consistency:
dart pub add --dev dep_audit
๐ Usage #
Quick Start #
# Navigate to your Dart/Flutter project
cd your_project
# Run basic audit
dep_audit
# Run with auto-fix
dep_audit --fix
# Include dev dependencies
dep_audit --include-dev
# Generate JSON report for CI
dep_audit --format json
Command Line Options #
Flag | Abbreviation | Description |
---|---|---|
--fix |
๐ง Automatically apply safe fixes | |
--path <directory> |
-p |
๐ Specify the project path to audit (default: . ) |
--include-dev |
๐ ๏ธ Include dev_dependencies in the audit |
|
--format <format> |
-f |
๐ Output format: text or json (default: text ) |
--help |
-h |
โ Show help information |
--version |
โน๏ธ Show version information |
๐ก Examples #
Basic Audit #
$ dep_audit
โ
Analyzing dependencies for your_project...
๐ฆ DEPENDENCY AUDIT REPORT
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Project: your_project โ
โ Dependencies: 12 total, 8 analyzed โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
๐ OUTDATED (3 found):
โโโ http: 0.13.5 โ 1.2.1 (available)
โโโ path: 1.8.3 โ 1.9.0 (available)
โโโ yaml: 3.1.1 โ 3.1.2 (available)
๐งน UNUSED (1 found):
โโโ crypto: declared but never imported
โ ๏ธ ABANDONED (0 found):
No abandoned packages detected.
๐ก Run with --fix to automatically update outdated and remove unused dependencies.
Auto-Fix Mode #
$ dep_audit --fix
โ
Analyzing dependencies...
๐ง Applying fixes...
โโโ Upgraded http: 0.13.5 โ 1.2.1
โโโ Upgraded path: 1.8.3 โ 1.9.0
โโโ Upgraded yaml: 3.1.1 โ 3.1.2
โโโ Removed unused: crypto
โ
All fixes applied successfully!
CI/CD Integration #
$ dep_audit --format json | jq '.outdated | length'
3
# GitHub Actions workflow
- name: Audit Dependencies
run: |
dart pub global activate dep_audit
dep_audit --format json > audit_report.json
# Fail if critical issues found
if [[ $(jq '.outdated | length' audit_report.json) -gt 5 ]]; then
echo "Too many outdated dependencies!"
exit 1
fi
โ๏ธ Configuration #
Create a dep_audit.yaml
file in your project root for custom configuration:
# dep_audit.yaml
ignore:
outdated:
- package_name # Ignore specific outdated packages
unused:
- test_package # Keep packages that might be used in tests
abandoned:
- legacy_pkg # Accept known legacy packages
thresholds:
outdated_days: 90 # Consider package outdated after 90 days
abandoned_days: 365 # Consider package abandoned after 1 year
include_dev: false # Include dev_dependencies by default
auto_fix: false # Enable auto-fix by default
format: "text" # Default output format
๐ค Contributing #
We welcome contributions! Please see our Contributing Guide for details.
Quick Contributing Steps #
- ๐ด Fork the repository
- ๐ฑ Create a feature branch (
git checkout -b feature/amazing-feature
) - ๐ป Make your changes
- โ
Run tests (
dart test
) - ๐ Commit your changes (
git commit -m 'Add amazing feature'
) - ๐ค Push to the branch (
git push origin feature/amazing-feature
) - ๐ Open a Pull Request
๐ License #
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Changelog #
See CHANGELOG.md for a detailed history of changes.
๐ Acknowledgments #
- Built with โค๏ธ using Dart
- Inspired by npm-audit and other dependency management tools
- Thanks to all contributors
Made with โค๏ธ by @B33b3k | Report Bug | Request Feature