A dependency upgrade can change more than the function your application imports. It might add an install script, move a command-line entry point, or ship a directory that was absent from the previous release. The changelog gives you the author's explanation. Comparing the two published tarballs shows the changes your application will actually receive.
Start with the exact version in your lockfile and the exact proposed replacement. Avoid moving tags such as latest: the review should refer to the same pair of artifacts when a teammate repeats it tomorrow. Keep both archives until the upgrade decision is recorded.
Capture both releases in separate directories
You need npm and a Linux or WSL shell with tar, sort, diff, and sha512sum. Save the script below as compare-release.sh, then invoke it with two exact name@version arguments from the upgrade proposal. Use the same package name for both arguments. The script downloads archives and reads their contents without installing the packages.
npm pack accepts a package specification, can save the tarball to a chosen directory, and supports JSON output. The explicit --ignore-scripts flag suppresses lifecycle execution for this operation. That control does not establish that the package is safe to execute later; npm documents its scope in the ignore-scripts reference.
#!/bin/sh set -eu OLD=${1:?Pass the old exact name@version} NEW=${2:?Pass the new exact name@version} WORK="$(mktemp -d)" mkdir "$WORK/old" "$WORK/new" npm pack "$OLD" --ignore-scripts --json \ --pack-destination "$WORK/old" > "$WORK/old/pack.json" npm pack "$NEW" --ignore-scripts --json \ --pack-destination "$WORK/new" > "$WORK/new/pack.json" for side in old new; do archive="$(find "$WORK/$side" -maxdepth 1 -name '*.tgz' -print -quit)" test -n "$archive" tar -tzf "$archive" > "$WORK/$side/files.unsorted" LC_ALL=C sort "$WORK/$side/files.unsorted" > "$WORK/$side/files.txt" tar -xOzf "$archive" package/package.json > "$WORK/$side/package.json" sha512sum "$archive" > "$WORK/$side/SHA512SUMS" done compare() { if diff -u "$1" "$2"; then : else status=$? [ "$status" -eq 1 ] || return "$status" fi } compare "$WORK/old/files.txt" "$WORK/new/files.txt" compare "$WORK/old/package.json" "$WORK/new/package.json" printf 'Review artifacts: %s\n' "$WORK" The helper accepts diff exit status 1, which means differences were found, while preserving error statuses. The sorted lists make added and removed paths easier to see. They do not compare the contents of files whose names stayed the same. The manifest diff may also contain formatting changes, so read the field values before treating every changed line as a behavior change.
Read the manifest changes in execution order
First inspect lifecycle scripts. A new postinstall command deserves a specific question: what does it run, and why does this release need it? Follow the referenced file in the archive as text. A change from one script filename to another can matter even when the script's name in package.json remains unchanged.
Next inspect entry points. Changes to main, exports, or bin can redirect the code used by imports or command-line invocations. npm's package.json reference describes those fields along with dependency declarations. Compare dependencies, optionalDependencies, and peerDependencies separately: a new runtime dependency and a changed peer requirement create different upgrade work.
Check whether changed entry points refer to files that appear in the archive listing. A new executable path with a matching new file is a concrete review target. A missing target may instead indicate a packaging mistake that would break consumers.
Connect file changes to the release explanation
Suppose a hypothetical comparison shows these three changes:
| Artifact difference | Follow-up before approving |
|---|---|
Added postinstall invoking scripts/setup.js | Read the script and identify any subprocesses or downloads |
bin now points to dist/cli.cjs | Inspect the new entry point and check supported invocation behavior |
Added vendor/ files | Establish their purpose, origin, and relevance to the upgrade |
These are review questions, not automatic rejection rules. A bundled native component may explain a new directory; removing unused sources may explain a much smaller archive. Unexplained changes should remain open items in the upgrade review.
For a manual exercise, compare one proposed upgrade against its currently locked version. Pick one changed manifest field and one changed file path. Trace each to the release notes or source change, and record whether the explanation accounts for what the archive contains. For a file present in both releases, inspect its contents too; identical filenames alone reveal nothing about changed behavior.
Attach the artifact identities to the decision
Keep the two exact package specifications, npm's pack output, archive checksums, and review notes together. The SHA-512 files identify the bytes inspected. Their hexadecimal output differs from the base64 encoding commonly used in integrity strings, so compare like encodings when checking against lockfile integrity metadata. A locally computed checksum alone establishes no publisher identity.
End the upgrade review with specific resolved questions: why the lifecycle command changed, where the new entry point leads, which dependencies were added, and what remains unexplained. That record gives the next reviewer a useful starting point if the package changes again.
