An Annual Dependency Audit for Your Package
Automated tools keep dependencies up to date week by week, but they never ask whether a dependency should be there at all. Once a year, pick a quiet week and look at every direct dependency of your package with fresh eyes. It usually takes an afternoon for a small library and repays itself in smaller installs, fewer advisories and less churn for your users.
Why once a year
Dependencies accumulate. One was added for a single helper function that the language now provides natively; another was pulled in for a feature you later removed; a third was healthy when you chose it and has since gone quiet. None of these show up as failures, so weekly maintenance never touches them. A fixed annual date, for example the first weeks of the new year after a holiday freeze, turns it into a habit rather than a project.
The questions for each direct dependency
- Is it still used? Search the source for imports. Tools such as depcheck for JavaScript or deptry for Python can flag unused declarations.
- Is it in the right section? Build and test tools belong in development dependencies; a framework your users already have may belong in peer dependencies rather than dependencies.
- Could the runtime replace it? Many once-common helpers now have standard-library equivalents.
- Is it maintained? Look at recent releases, open security advisories and whether issues get responses. An OpenSSF Scorecard result can be a useful summary, as one input among several.
- What does it cost? Check its own transitive dependencies and install scripts. A small direct dependency can bring a large tree.
- Is the licence still compatible? Licences occasionally change between major versions; confirm the SPDX identifier of the version you resolve.
- Is the version range sensible? Too loose and you accept breaking majors; too tight and you force duplicate copies on your users.
A worksheet to record decisions
| Dependency | Used for | Section | Licence | Health | Decision |
|---|---|---|---|---|---|
| Package A (illustrative) | Argument parsing | runtime | MIT | Active | Keep |
| Package B (illustrative) | One string helper | runtime | ISC | Inactive | Replace with built-in |
| Package C (illustrative) | Test fixtures | runtime (wrong) | MIT | Active | Move to dev |
Keep the worksheet in the repository, for example as docs/dependency-audit.md, so next year's audit starts from this year's reasoning rather than from scratch.
Shipping the results
Removing or moving a dependency is usually invisible to users, so a minor or patch release is fine. Changing a dependency to a peer dependency, or raising a peer range, can break installs and deserves careful thought about versioning; our peer dependencies explainer covers that. Note every change in the changelog under a "Dependencies" heading, and mention any reduction in install size you measured.