deps/npm/docs/output/commands/npm-diff.html
npm diff [...<paths>]
Similar to its git diff counterpart, this command will print diff patches of files for packages published to the npm registry.
npm diff --diff=<spec-a> --diff=<spec-b>
npm diff (in a package directory, no arguments):
npm diff --diff=<pkg-name> (in a package directory):
npm diff --diff=<spec-a> (in a package directory):
npm diff --diff=<semver-a> [--diff=<semver-b>] (in a package directory):
Note that tag names are not valid --diff argument values, if you wish to compare to a published tag, you must use the pkg@tagname syntax.
It's possible to also specify positional arguments using file names or globs pattern matching in order to limit the result of diff patches to only a subset of files for a given package, e.g:
npm diff --diff=pkg@2 ./lib/ CHANGELOG.md
In the example above the diff output is only going to print contents of files located within the folder ./lib/ and changed lines of code within the CHANGELOG.md file.
diffDefine arguments to compare in npm diff.
diff-name-onlyPrints only filenames when using npm diff.
diff-unifiedThe number of lines of context to print in npm diff.
diff-ignore-all-spaceIgnore whitespace when comparing lines in npm diff.
diff-no-prefixDo not show any source or destination prefix in npm diff output.
Note: this causes npm diff to ignore the --diff-src-prefix and --diff-dst-prefix configs.
diff-src-prefixSource prefix to be used in npm diff output.
diff-dst-prefixDestination prefix to be used in npm diff output.
diff-textTreat all files as text in npm diff.
globalOperates in "global" mode, so that packages are installed into the prefix folder instead of the current working directory. See folders for more on the differences in behavior.
{prefix}/lib/node_modules folder, instead of the current working directory.{prefix}/bin{prefix}/share/mantagIf you ask npm to install a package and don't tell it a specific version, then it will install the specified tag.
It is the tag added to the package@version specified in the npm dist-tag add command, if no explicit tag is given.
When used by the npm diff command, this is the tag used to fetch the tarball that will be compared with the local files by default.
If used in the npm publish command, this is the tag that will be added to the package submitted to the registry.
workspaceEnable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.
Valid values for the workspace config are either:
When set for the npm init command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
This value is not exported to the environment for child processes.
workspacesSet to true to run the command in the context of all configured workspaces.
Explicitly setting this to false will cause commands like install to ignore workspaces altogether. When not set explicitly:
node_modules tree (install, update, etc.) will link workspaces into the node_modules folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, unless one or more workspaces are specified in the workspace config.This value is not exported to the environment for child processes.
include-workspace-rootInclude the workspace root when workspaces are enabled for a command.
When false, specifying individual workspaces via the workspace config, or all workspaces via the workspaces flag, will cause npm to operate only on the specified workspaces, and not on the root project.
This value is not exported to the environment for child processes.