0.2.0 • Published 10 months ago

@sephsekla/npm-package-diff v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Package Diff Command

Generates a report of changes to npm packages in different formats. Inspired by IonBazan/composer-diff.

Installation

To install globally, run

npm install -g @sephsekla/npm-package-diff

Alternatively, you can install on the first run by specifying the package:

npx package-diff -p @sephsekla/npm-package-diff

Requirements and Compatibility

Tested on current, pending and LTS Node versions:

  • Node 16
  • Node 18
  • Node 19
  • Node 20

Currently npm only, however pnpm and Yarn support is planned.

Usage

Compare installed npm packages to the latest git commit:

npx package-diff

Options

Base

-b, --base 

The base to compare against (a git branch or commit). Default HEAD

Format

-f, --format

The format to output:

OptionDescription
mdlistA markdown-formatted list of changes (Default)
mdtableA markdown-formatted table of changes
jsonA json object featuring packages, operations and versions. Recommended for CI and chain commands.

Example Usage

> npx package-diff

- Install @foo/bar [1.2.3]
- Uninstall lorem [2.0.0]
- Update ipsum [ 1.0.0 => 1.0.2 ]
> npx package-diff -f mdtable 

| Package | Operation | Base | Target |
| - | - | - | - |
| @foo/bar | install | - | 1.2.3 |
| lorem | uninstall | 2.0.0 | - |
| ipsum | update | 1.0.0 | 1.0.2 |
> npx package-diff -f json 

{
    "@foo/bar": {
        "operation": "install",
        "newVersion": "1.2.3"
    },
    "lorem": {
        "operation": "uninstall",
        "prevVersion": "2.0.0",
    },
    "ipsum": {
        "operation": "update",
        "prevVersion": "1.0.0",
        "newVersion": "1.0.2"
    }
}
0.3.0

4 months ago

0.2.0

10 months ago

0.1.1

11 months ago

0.1.0

11 months ago