Interactive Tutorial
Learn pastoralist step-by-step
Quick Start
# Create a test project
mkdir test-pastoralist && cd test-pastoralist
# Create package.json with a transitive override
echo '{
"name": "test",
"dependencies": {
"express": "^4.18.0"
},
"overrides": {
"qs": "6.11.2"
}
}' > package.json
# Install and run pastoralist
npm install
npm install --save-dev pastoralist
npx pastoralist
# Check the result
cat package.json
How It Works
Before Pastoralist
{
"dependencies": {
"express": "^4.18.0"
},
"overrides": {
"qs": "6.11.2"
}
}
After Pastoralist
{
"overrides": {
"qs": "6.11.2"
},
"pastoralist": {
"appendix": {
"[email protected]": {
"dependents": {
"express": "[email protected]"
},
"ledger": {
"addedDate": "2026-05-30T00:00:00.000Z",
"source": "manual"
}
}
}
}
}
Cleanup
When dependencies no longer need an override, Pastoralist labels it as unused.
Run with --remove-unused to remove the override and appendix entry:
npx pastoralist --remove-unused
Setup
Install
npm install --save-dev pastoralist
Add to postinstall
{
"scripts": {
"postinstall": "pastoralist"
}
}
For Monorepos
# Root package
pastoralist
# Specific workspace
pastoralist --path packages/app/package.json
Common Use Cases
Security Patches
{
"overrides": {
"minimist": "1.2.8"
},
"pastoralist": {
"appendix": {
"[email protected]": {
"ledger": {
"addedDate": "2026-05-30T00:00:00.000Z",
"reason": "Pin minimist to a patched version while upstream dependencies update.",
"source": "security",
"cves": ["CVE-2021-44906"],
"severity": "high",
"patchedVersion": "1.2.8"
}
}
}
}
}
Pastoralist keeps the security context with the override so you can remove it when upstream dependencies no longer need it.
Version Conflicts
{
"overrides": {
"react": "17.0.2"
},
"pastoralist": {
"appendix": {
"[email protected]": {
"ledger": {
"addedDate": "2026-05-30T00:00:00.000Z",
"reason": "Legacy app compatibility",
"source": "manual"
}
}
}
}
}
The appendix shows which packages aren't ready for React 18.
API Usage
import { resolveJSON, update } from "pastoralist";
const path = "./package.json";
const config = resolveJSON(path);
if (config) {
update({ config, path });
}
Try It Now
Open Interactive Demos to see pastoralist in action!