pacquet icon indicating copy to clipboard operation
pacquet copied to clipboard

[Feature Request] git diff friendly format of lockfile

Open SoonIter opened this issue 2 years ago • 0 comments

The story of users

  1. yaml file is not friendly to git diff. Almost every time in git diff, each diff block will be confused by same content from different rows and different projects as shown in the images below. This kind of code diff is not easy to read.

  2. In a larger repository, there are usually many people working together, but their projects may be irrelevant. The lockfile conflict causes them to have to merge manually.

image

image

the solution I think

Inspired by Go's lockfile called "Go.sum", new format of lockfile stores the meta data of each packages in only one line.

image

The format I designed is like this.

before

image

after

// new-format.lock
// Nodes
[email protected] sha512-xxxxxxxxxx=  noDev
[email protected] sha-xxxxxxxxxx= hasBin noDev
[email protected] sha512-xxxxxxx= engines: {node: '>=0.10.0'} noDev

// Edges
[email protected] -> [email protected]
[email protected] -> [email protected]

Then, if I add a new version of loose-envify,code diff would become like this.

// new-format.lock
[email protected] sha512-xxxxxxxxxx=  noDev
- [email protected] sha-xxxxxxxxxx= hasBin noDev
+ [email protected] sha-xxxxxxxxxx= hasBin noDev
[email protected] sha512-xxxxxxx= engines: {node: '>=0.10.0'} noDev

- [email protected] -> [email protected]
- [email protected] -> [email protected]
+ [email protected] -> [email protected]
+ [email protected] -> [email protected]

The reason why I open this issue is that I think the new package manager should have more opportunities to try experimental features

SoonIter avatar Aug 07 '23 20:08 SoonIter