davidrjonas / composer-lock-diff

See what has changed after a composer update
MIT License
274 stars 18 forks source link

Feature request: compare link #9

Closed nclavaud closed 6 years ago

nclavaud commented 6 years ago

Hey, thanks a lot for this utility. We have a script running composer update and generating a pull request automatically on a daily basis, and we could not manage to parse the output correctly until we found this project 🎉

Any plan to add something like a "compare" link that will show the link to compare the two versions?

For example:

Production Changes From To Compare
aws/aws-sdk-php 3.52.6 3.52.7 3.52.6...3.52.7
cafferata commented 6 years ago

Hi @nclavaud, I think it's a nice idea and have therefore made a first setup. @davidrjonas what do you think of this?

Production Changes From To Compare
beberlei/assert v2.7.8 v2.9.2 https://github.com/beberlei/assert/compare/v2.7.8...v2.9.2
beberlei/doctrineextensions v1.0.20 v1.0.21 https://github.com/beberlei/DoctrineExtensions/compare/v1.0.20...v1.0.21
composer/ca-bundle 1.0.8 1.1.0 https://github.com/composer/ca-bundle/compare/1.0.8...1.1.0
doctrine/annotations v1.5.0 v1.6.0 https://github.com/doctrine/annotations/compare/v1.5.0...v1.6.0
doctrine/dbal v2.6.2 v2.6.3 https://github.com/doctrine/dbal/compare/v2.6.2...v2.6.3
doctrine/doctrine-bundle 1.7.2 1.8.1 https://github.com/doctrine/DoctrineBundle/compare/1.7.2...1.8.1
doctrine/inflector v1.2.0 v1.3.0 https://github.com/doctrine/inflector/compare/v1.2.0...v1.3.0
doctrine/migrations v1.6.0 v1.6.2 https://github.com/doctrine/migrations/compare/v1.6.0...v1.6.2
doctrine/orm v2.5.12 v2.6.0 https://github.com/doctrine/doctrine2/compare/v2.5.12...v2.6.0
davidrjonas commented 6 years ago

I agree, it's an excellent idea. Thanks! And thanks @cafferata for the nicely segmented pull requests.

I implemented the output in a slightly different way than either of you suggested since the repetition felt wrong to me. I tried a few other ideas, like making the To column the link but that didn't play nice with plain text. I mean really, the whole output could just be the Compare column as @cafferata has it formatted; it has all the information. But in the spirit of an easy to read table format I chose simple text, "...", as the link in markdown. For plain text there just isn't much of an option so the whole link is displayed. I hope that works for both of you.

I also implemented it in a way that is a little more pluggable, with Bitbucket and GitLab as well as GitHub. I couldn't find any officially supported list from Packagist so if you know of any others that should get in there let me know. I'm thinking about how to add custom types. Perhaps something like --custom-link mygitlab.local=gitlab --custom-link gh.example.com=github as long as the it is just a difference in the host. But I guess I'll wait until someone requests it.

davidrjonas commented 6 years ago

https://github.com/davidrjonas/composer-lock-diff/compare/1.2.0...1.3.0