A tool to peek at and compare yarn lockfiles.
This package is available via npm
. To install globally, run the following command:
npm install -g lock-check
Note that node
and npm
must be installed prior to the command being run. The recommended minimum node
version is v10
.
There are a number of commands available for the lock-check
tool:
peek
: Peek at the requested vs resolved versions of packages within a single lockfilecompare
: Compare the requested vs resolved versions of packages between two lockfiles
A list of currently available commands can also be fetched from the tool by running the help
command:
lock-check help
The peek
command takes a single relative path to a yarn
lockfile, and performs a simple transform. The transform will output a table to the console window, outlining the requested vs resolved versions of yarn
packages that have been included in the specified lockfile.
Here is the API for the peek
command:
peek <lockfile>
Here is an example usage of the peek
command:
lock-check peek ./yarn.lock
Here is an example of the output for the peek
command:
┌─────────┬───────┬───────────────┬──────────┐
│ (index) │ name │ requested │ resolved │
├─────────┼───────┼───────────────┼──────────┤
│ 0 │ 'foo' │ [ '^10.2.3' ] │ '10.2.4' │
│ 1 │ 'bar' │ [ '^2.20.3' ] │ '2.20.4' │
│ 2 │ 'baz' │ [ '^3.2.30' ] │ '3.2.40' │
└─────────┴───────┴───────────────┴──────────┘
The compare
command takes a two relative paths to two separate yarn
lockfiles, and performs a comparison. The comparison will output a table to the console window, outlining the requested vs resolved versions of yarn
packages that have been included across the two specified lockfiles.
Here is the API for the compare
command:
compare <first-lockfile> <second-lockfile>
Here is an example usage of the compare
command:
lock-check compare ./project-1/yarn.lock ./project-2/yarn.lock
Here is an example of the output for the compare
command:
┌─────────┬───────┬──────────────────────────┬─────────────────────────┬───────────────────────────┬──────────────────────────┐
│ (index) │ name │ first lockfile requested │ first lockfile resolved │ second lockfile requested │ second lockfile resolved │
├─────────┼───────┼──────────────────────────┼─────────────────────────┼───────────────────────────┼──────────────────────────┤
│ 0 │ 'bar' │ [ '^2.20.3' ] │ [ '2.20.4' ] │ [ '^2.20.3', '^2.20.4' ] │ [ '2.20.5' ] │
│ 1 │ 'baz' │ [ '^3.2.30' ] │ [ '3.2.40' ] │ [ '^3.2.30', '~3.2.40' ] │ [ '3.2.50' ] │
│ 2 │ 'foo' │ [ '^10.2.3' ] │ [ '10.2.4' ] │ [ '^10.2.3', '^10.2.4' ] │ [ '10.2.5' ] │
└─────────┴───────┴──────────────────────────┴─────────────────────────┴───────────────────────────┴──────────────────────────┘