Add a new command that enables diff workflows (similar to git diff
) for
packages published in the registry.
- Package Consumers: Complements
npm audit
andnpm outdated
workflows by providing insight on what changed across different versions of a package. - Package Authors: Enables diff packlist-tracked-only file changes prior to publishing a new version of a package, or while debugging past changes.
Introduce a new npm diff
command that accepts one or more package specs and
uses these specs to compare files and print diff patches. Contents are fetched
using pacote
, accepting any type of specs that the npm installer understands.
Using a single <spec>
allows users to retrieve diff output between an
existing valid version of a package with the same name found in the actual
dependency tree and the exact <spec>
match from the registry.
Fetches/reads contents of two versions of a package, represented by
<spec-a>
and <spec-b>
and prints diff output.
Meant as a helper tool to package authors, prints diff output between the current file system dirs/files (tracked by packlist) and the last published version of that package.
- A very common workflow is using npm outdated to figure out what dependencies need update and then manually reviewing what changed in between the current version you have in your project and whatever you can update to. That workflow involves multiple steps, some of them being extra mental hurdle (such as keeping track of the semver versions change and their meaning) some other very manual such as jumping around to repos, scanning through changelogs, veryfing semver contract is respected, etc.
- It feels very natural to have a
npm diff
from the point of view of a user ofgit diff
s - It does provide much more quick insight and transparency on code that makes its way into our projects in a (medium) that most developers are already familiar with.
- Not have a native
npm diff
command and deffer to userland solutions tools.
Reads two different specs using pacote and run a diff of each file, providing an usable patch output for users to work with.