Interactive Tutorial
Learn Pastoralist step by step
Learn Pastoralist step by step
# Create a test projectmkdir test-pastoralist && cd test-pastoralist # Create package.json with a transitive overrideecho '{ "name": "test", "dependencies": { "express": "^4.18.0" }, "overrides": { "qs": "6.11.2" }}' > package.json # Install and run Pastoralistnpm installnpm install --save-dev pastoralistnpx pastoralist # Check the resultcat package.json{ "dependencies": { "express": "^4.18.0" }, "overrides": { "qs": "6.11.2" }}{ "overrides": { "qs": "6.11.2" }, "pastoralist": { "appendix": { "[email protected]": { "dependents": { "express": "[email protected]" }, "ledger": { "addedDate": "2026-05-30T00:00:00.000Z", "source": "manual" } } } }}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-unusednpm install --save-dev pastoralist{ "scripts": { "postinstall": "pastoralist" }}# Root packagepastoralist # Specific workspacepastoralist --path packages/app/package.json{ "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.
{ "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.
import { resolveJSON, update } from "pastoralist"; const path = "./package.json";const config = resolveJSON(path); if (config) { update({ config, path });}Open Interactive Demos to see Pastoralist in action.
# 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{
"dependencies": {
"express": "^4.18.0"
},
"overrides": {
"qs": "6.11.2"
}
}{
"overrides": {
"qs": "6.11.2"
},
"pastoralist": {
"appendix": {
"[email protected]": {
"dependents": {
"express": "[email protected]"
},
"ledger": {
"addedDate": "2026-05-30T00:00:00.000Z",
"source": "manual"
}
}
}
}
}npx pastoralist --remove-unusednpm install --save-dev pastoralist{
"scripts": {
"postinstall": "pastoralist"
}
}# Root package
pastoralist
# Specific workspace
pastoralist --path packages/app/package.json{
"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"
}
}
}
}
}{
"overrides": {
"react": "17.0.2"
},
"pastoralist": {
"appendix": {
"[email protected]": {
"ledger": {
"addedDate": "2026-05-30T00:00:00.000Z",
"reason": "Legacy app compatibility",
"source": "manual"
}
}
}
}
}import { resolveJSON, update } from "pastoralist";
const path = "./package.json";
const config = resolveJSON(path);
if (config) {
update({ config, path });
}