Skip to content
Lock file diff summary

package-lock.json Diff Summarizer

Paste a package-lock.json from before and after to get a summary of **added, removed, upgraded and downgraded** packages, split into major / minor / patch. A lock that changed by thousands of lines in a PR becomes one table.
It also lists changes to direct dependencies (those in package.json), the cleanup of duplicate versions, packages whose hash changed with the same version, packages that newly have install scripts or became deprecated, and http or git sources. The result can be copied as a Markdown table for a PR description.
The files are read only in your browser: never sent to a server and not stored in this browser. The registry is not queried, so what changed inside the packages (the code diff) is not shown.

The files are read only in your browser and never sent to a server. They are not stored in this browser either.

Guide

How to use & features

  • Paste the contents into "package-lock.json before" and "package-lock.json after", or load each file with "Choose a file". A sample is loaded at first.
  • It compares them automatically. "Overview" shows counts of added, removed, upgraded, downgraded and versions-changed packages, with a major / minor / patch breakdown.
  • "Changes to direct dependencies (package.json)" shows packages you added, removed or changed the range of in package.json.
  • "Changes" can be narrowed with "Direct dependencies only" and a kind. "Copy as Markdown" gives a table for a PR description. If you mixed up before and after, use "Swap before / after".
  • "Things worth a look" lists packages whose hash changed with the same version, new install scripts, newly deprecated packages, http or git sources and version downgrades.
FAQ

FAQ

  • What is compared with what?

    Packages are compared by **name**, looking at which versions are installed before and after. When one version is replaced by another, it is "upgraded" or "downgraded" (with major / minor / patch); anything else, such as several versions being tidied up, is "versions changed", showing the versions before and after. A change only in the nested location (`node_modules/a/node_modules/b`) is not counted.
  • What does "the hash changed with the same version" mean?

    The lock records a hash (`integrity`) for each package alongside its version. A hash that **changes while the version stays the same** is not normal. It can mean a republish, a change of source or tampering, so it needs checking. The tool finds and reports it. It does not look at the contents (the code diff).
  • Which lock files are supported?

    npm's `package-lock.json` (lockfileVersion 1, 2 and 3). `yarn.lock` (classic and Berry) can be compared too; `pnpm-lock.yaml` (v6 and v9) is supported too, and yarn.lock records no install scripts or deprecations, so those checks do not appear. If lockfileVersion differs between the two, the diff can look larger, so the tool says so.
  • Are my lock files sent to a server?

    No. The files are read only in your browser and never sent to a server. They are not stored in this browser either.
  • Does it work with huge lock files?

    Locks with tens of thousands of packages can be compared, but at most 500 rows are shown in the table. Narrow it down with "Direct dependencies only" or a kind. Counts and checks are taken over everything.
  • What is the "Via" column?

    For packages that are not direct dependencies, it shows the shortest path from a direct dependency of the root to that package, as `a → b → c`. When an unfamiliar package shows up, you can trace what pulled it in. Added, upgraded and changed packages are traced in the new lock, removed ones in the old lock. If there are several paths, only the shortest one is shown.
Use cases

Common use cases

  • Review lock changes in a PR

    Turn a diff of thousands of lines in `package-lock.json` into a table of added, removed, upgraded and downgraded packages. Major updates come first.
  • See what an update changed

    After `npm update` or an update from Renovate or Dependabot, see what moved among **indirect dependencies**, not only direct ones.
  • Notice supply-chain oddities

    Packages whose hash changed with the same version, or that newly have install scripts, are leads when reviewing a lock.
  • Paste it into a PR description or release notes

    "Copy as Markdown" gives a table of the changes you can paste straight into a PR description.
Notes

Notes & limitations

  • It does not show what changed inside packages

    The registry is not queried, so how the code changed inside a package is not checked. Only what the locks record is used: versions, hashes, sources and whether there are install scripts.
  • Only npm lock files are supported

    `package-lock.json` (lockfileVersion 1, 2 and 3) is supported, and so is `yarn.lock` (classic and Berry; `pnpm-lock.yaml` is not). yarn.lock records no install scripts or deprecations, so those checks do not appear.
  • The table shows at most 500 rows

    With many changes, up to 500 rows go in the table. Counts in the overview and the checks are taken over everything.

Articles for this tool

Recent Articles