Dependency Management
Understanding how Terreno manages dependencies, updates, and security.
Overview
Terreno uses a multi-layered approach to dependency management:
- Bun catalogs for version consistency across the monorepo
- Dependabot for automated dependency updates
- Auto-merge workflow for hands-off maintenance
- 7-day cooldown for security and stability
Bun Catalogs
Shared dependency versions are defined in the root package.json under the catalog field. Workspace packages reference catalog versions with catalog: prefix.
Benefits:
- Single source of truth for shared dependency versions
- Consistent versions across all packages
- Easier updates — change once, apply everywhere
Example:
// root package.json
{
"catalog": {
"react": "19.1.0",
"react-native": "0.81.5"
}
}
// ui/package.json
{
"dependencies": {
"react": "catalog:",
"react-native": "catalog:"
}
}
Dependabot Configuration
Dependabot monitors dependencies across the monorepo with different update schedules and grouping strategies.
Update Groups
| Group | Packages | Schedule | Strategy |
|---|---|---|---|
| GitHub Actions | Workflow dependencies | Weekly | Individual PRs |
| Root | Catalog & dev tools | Monthly | Grouped PR |
| Backend | api, example-backend, mcp-server | Monthly | Grouped PR |
| Frontend | ui, rtk, demo, example-frontend | Monthly | Grouped PR |
7-Day Cooldown
Why: Malicious actors occasionally compromise NPM packages. Most compromises are detected and removed within 24 hours.
How it works:
- Dependabot waits 7 days after a package version is published before creating a PR
- Security updates bypass the cooldown (immediate PRs for CVEs)
- Reduces risk of incorporating compromised dependencies
Configuration:
cooldown:
default-days: 7
Ignored Dependencies
Frontend packages ignore catalog-managed dependencies to prevent duplicate PRs. Updates to these dependencies must be done via the root package.json catalog.
Examples:
react,react-native,expo,typescript@reduxjs/toolkit,luxon,lodash- All other dependencies listed in the root catalog
Auto-Merge Workflow
The dependabot-auto-merge.yml workflow automatically approves and merges Dependabot PRs once all CI checks pass.
How It Works
- Trigger: Runs on every pull request
- Condition: Only executes if author is
dependabot[bot] - Approval: Automatically approves the PR using
GITHUB_TOKEN - Auto-merge: Enables squash-merge with
--autoflag - Merge: PR merges automatically once all required status checks pass
Prerequisites
For auto-merge to function:
- ✅ Enable "Allow auto-merge" in Settings → General → Pull Requests
- ✅ Configure branch protection on
masterwith required status checks - ✅ All configured CI workflows (api-ci, ui-ci, etc.) must pass
Security Considerations
Why this is safe:
- PRs only merge after all CI checks pass (tests, linting, builds)
- Security updates bypass cooldown but still require passing tests
- Grouped PRs reduce noise while maintaining test coverage
- Failed CI checks prevent merge — human review required
When human review is needed:
- CI failures on Dependabot PRs
- Major version updates (may include breaking changes)
- Updates that touch critical dependencies (e.g., Express, React Native core)
Workflow Diagram
flowchart TD
A[Package Version Published] -->|Wait 7 days| B{Security Update?}
B -->|Yes| C[Immediate PR Creation]
B -->|No| D[Create PR after cooldown]
C --> E[Auto-merge Workflow Triggered]
D --> E
E --> F{All CI Checks Pass?}
F -->|Yes| G[Auto-approve PR]
F -->|No| H[Require Human Review]
G --> I[Enable Auto-merge]
I --> J[Squash & Merge]
H --> K[Fix Issues & Re-run CI]
K --> F
Best Practices
When to Update the Catalog
Update root package.json catalog when:
- Multiple packages need the same dependency update
- Major version updates require coordinated changes
- New shared dependencies are introduced
When to Update Individual Packages
Update individual package dependencies when:
- Package-specific dependencies (not in catalog)
- Testing new versions before promoting to catalog
- Overriding catalog versions for specific use cases (rare)
Monitoring Dependabot
Check Dependabot activity:
- Navigate to Security → Dependabot in GitHub repository
- Review open PRs with
dependencieslabel - Check for failed updates or security alerts
- Monitor auto-merge success rate in Actions tab
Troubleshooting
Dependabot PR Not Auto-Merging
Symptom: PR approved but not merging
Checks:
- Are all required status checks passing?
- Is auto-merge enabled in repository settings?
- Is branch protection configured on
master? - Check Actions tab for workflow failures
CI Failures on Dependency Updates
Symptom: Dependabot PR fails CI
Actions:
- Review CI logs to identify breaking changes
- Check dependency changelog for migration guides
- Update code to accommodate breaking changes
- Push fixes to the Dependabot branch or close PR
Too Many Dependabot PRs
Symptom: Overwhelming number of update PRs
Solutions:
- Verify grouping is configured correctly in
.github/dependabot.yml - Adjust update schedules (weekly → monthly)
- Add dependencies to ignore list if catalog-managed
- Increase cooldown period if needed
Related Documentation
- CI/CD Workflows (coming soon)
- GitHub Actions Security
- Dependabot Documentation