{"id":51118943,"url":"https://github.com/sulthonzh/lockfile-diff","last_synced_at":"2026-06-25T00:30:34.030Z","repository":{"id":366085349,"uuid":"1268321214","full_name":"sulthonzh/lockfile-diff","owner":"sulthonzh","description":"Diff two npm/yarn/pnpm lockfiles to see what packages were added, removed, or version-bumped","archived":false,"fork":false,"pushed_at":"2026-06-20T07:42:32.000Z","size":21,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-20T08:16:25.474Z","etag":null,"topics":["dependencies","diff","lockfile","npm","package-lock","pnpm","yarn"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sulthonzh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-13T11:50:29.000Z","updated_at":"2026-06-20T07:42:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sulthonzh/lockfile-diff","commit_stats":null,"previous_names":["sulthonzh/lockfile-diff"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/sulthonzh/lockfile-diff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Flockfile-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Flockfile-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Flockfile-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Flockfile-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sulthonzh","download_url":"https://codeload.github.com/sulthonzh/lockfile-diff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Flockfile-diff/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34755061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependencies","diff","lockfile","npm","package-lock","pnpm","yarn"],"created_at":"2026-06-25T00:30:33.949Z","updated_at":"2026-06-25T00:30:34.021Z","avatar_url":"https://github.com/sulthonzh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lockfile-diff\n\nDiff two npm lockfiles and see exactly what packages were added, removed, or version-bumped. Supports npm, yarn, and pnpm — and you can mix formats.\n\nEver rebased a branch and wondered \"what deps changed?\" or reviewed a PR and wanted to see the lockfile impact without scrolling through thousands of lines? That's what this is for.\n\n## Install\n\n```bash\nnpm install -g lockfile-diff\n# or just use it directly\nnpx lockfile-diff old-lock.json new-lock.json\n```\n\n## Quick Start\n\n```bash\n# Diff two package-lock.json files\nlockfile-diff old-package-lock.json new-package-lock.json\n\n# JSON output for scripting\nlockfile-diff --json old.lock new.lock | jq '.stats'\n\n# CI mode — exits non-zero if anything changed\nlockfile-diff --ci old.lock new.lock\n```\n\n## Real-World Examples\n\n### 1. PR Review Gate — Block Risky Dep Bumps\n\nAdd to your CI pipeline to catch major version bumps in pull requests:\n\n```bash\n# In your CI, after checkout\ngit fetch origin main\ngit diff origin/main..HEAD -- package-lock.json \u003e /tmp/old-lock.json 2\u003e/dev/null || true\n# If lockfile changed, check for major bumps\nlockfile-diff --json /tmp/old-lock.json package-lock.json | \\\n  jq -e '.stats.changeTypes.major \u003e 0' \u0026\u0026 \\\n  echo \"⚠️  Major version bump detected — please review\" \u0026\u0026 exit 1\n```\n\nThis catches when a transitive dep silently jumps a major version (e.g., `express@4` → `express@5`), which could break production.\n\n### 2. Migration Audit — yarn → npm\n\nWhen migrating from yarn to npm (or vice versa), verify no deps were lost:\n\n```bash\n# Mix formats — diff yarn.lock against the new package-lock.json\nlockfile-diff yarn.lock package-lock.json --filter removed\n```\n\nThis shows any packages that existed in yarn but disappeared after switching to npm, ensuring no transitive dependencies were accidentally dropped.\n\n### 3. Release Changelog — What Changed Since Last Release\n\nGenerate a dependency changelog between two git tags:\n\n```bash\n#!/bin/bash\n# deps-changelog.sh — run before publishing\nOLD=$(git show v1.2.0:package-lock.json 2\u003e/dev/null)\nNEW=$(cat package-lock.json)\necho \"$OLD\" \u003e /tmp/old.json\necho \"$NEW\" \u003e /tmp/new.json\nlockfile-diff --summary /tmp/old.json /tmp/new.json\necho \"\"\necho \"Full diff:\"\nlockfile-diff /tmp/old.json /tmp/new.json --filter added --filter changed\n```\n\nOutput:\n```\nLockfile Diff Summary\n─────────────────────────────────────\n  Added:     3\n  Removed:   1\n  Changed:   7  (2 major, 3 minor, 2 patch)\n  Unchanged: 142\n  Total:     153\n```\n\n## Supported Formats\n\n| Format | File | Support |\n|--------|------|---------|\n| npm | `package-lock.json` | v1, v2, v3 |\n| yarn | `yarn.lock` | v1, Berry |\n| pnpm | `pnpm-lock.yaml` | v9 (packages section, including peer dep annotations) |\n\nYou can mix formats too — diff a `yarn.lock` against a `package-lock.json` if you're migrating.\n\n## CLI Options\n\n```\nUsage:\n  lockfile-diff \u003cbefore\u003e \u003cafter\u003e [options]\n\nOptions:\n  --json              Output as JSON\n  --ci                Exit non-zero if any changes found\n  --summary           Show only summary stats\n  --no-unchanged      Hide unchanged packages (default: hidden)\n  --show-unchanged    Show unchanged packages\n  --filter \u003ctype\u003e     Filter: added, removed, changed, unchanged (repeatable)\n  -h, --help          Show help\n  -v, --version       Show version\n```\n\n## JSON Output\n\n```bash\nlockfile-diff --json old.lock new.lock\n```\n\n```json\n{\n  \"before\": { \"file\": \"old.lock\", \"format\": \"npm\", \"packages\": 120 },\n  \"after\": { \"file\": \"new.lock\", \"format\": \"npm\", \"packages\": 122 },\n  \"diff\": {\n    \"added\": [{ \"name\": \"mocha\", \"version\": \"10.0.0\" }],\n    \"removed\": [{ \"name\": \"express\", \"version\": \"4.17.0\" }],\n    \"changed\": [{ \"name\": \"lodash\", \"before\": \"4.17.20\", \"after\": \"4.17.21\" }],\n    \"unchanged\": [...]\n  },\n  \"stats\": {\n    \"added\": 1, \"removed\": 1, \"changed\": 1, \"unchanged\": 118,\n    \"total\": 121,\n    \"changeTypes\": { \"major\": 0, \"minor\": 0, \"patch\": 1, \"prerelease\": 0, \"unknown\": 0 }\n  }\n}\n```\n\n## Comparison\n\n| Feature | `lockfile-diff` | `git diff` | `npm ls` | `lockfile-lint` |\n|---------|:---:|:---:|:---:|:---:|\n| Multi-format (npm/yarn/pnpm) | ✅ | ❌ | npm only | npm only |\n| Cross-format diff (yarn→npm) | ✅ | ❌ | ❌ | ❌ |\n| Semver change classification | ✅ | ❌ | ❌ | ❌ |\n| JSON output | ✅ | ✅ | ❌ | ✅ |\n| CI exit codes | ✅ | ✅ | ❌ | ✅ |\n| Zero dependencies | ✅ | — | ❌ | ❌ |\n| Human-readable summary | ✅ | ❌ | ❌ | ❌ |\n\n## Why?\n\nBecause `git diff package-lock.json` is unreadable. Lockfiles are machine-generated, massive, and reordered constantly. This tool parses the actual dependency tree and shows you what matters: what got added, what got removed, what version changed.\n\n## Zero Dependencies\n\nNo `node_modules` black hole. Pure Node.js, runs anywhere.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsulthonzh%2Flockfile-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsulthonzh%2Flockfile-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsulthonzh%2Flockfile-diff/lists"}