babashka / neil

A CLI to add common aliases and features to deps.edn-based projects
MIT License
377 stars 27 forks source link

Dependency versions can be pinned #228

Closed teodorlu closed 5 months ago

teodorlu commented 5 months ago

Please answer the following questions and leave the below in as part of your PR.

Progress

I'm ready to merge if everything looks good.

Motivation

neil users may not always want to update a dependency, for example due to introduced breaking changes. Currently, neil dep upgrade will upgrade all those dependencies, and the user will have to revert the change by hand.

Implemented behavior

Dependencies in deps.edn can now be pinned. Pinned dependencies have :neil/pinned set to true. Running neil dep upgrade on the following deps.edn file will upgrade cheshire/cheshire, but leave hiccup/hiccup alone.

{:deps {hiccup/hiccup {:mvn/version "1.0.0"
                       :neil/pinned true}
        cheshire/cheshire {:mvn/version "4.0.0"}}
 :aliases {}}

Pinned dependencies are ignored when neil dep upgrade updates dependencies.

Future ideas

neil dep add could support an optional --pin argument. Something like this:

neil dep add hiccup --pin
borkdude commented 5 months ago

I think this PR takes the original issue a bit further than I imagined. Just supporting adding :neil/pinned true manually in deps.edn is basically what I imagined. I don't think I'd want to type neil dep pin foobar/foobar which is about the same, if not more effort than just editing the deps.edn.

teodorlu commented 5 months ago

OK, I'll update the PR.

I agree that it might be too much to introduce at once, at least before we know whether a new option and changed neil dep add behavior is actually needed.

teodorlu commented 5 months ago

I don't think I'd want to type neil dep pin foobar/foobar which is about the same, if not more effort than just editing the deps.edn.

Note: the behavior change i implemented did not add a new subcommand, but an optional argument :pin to neil dep add. Similar, but not exactly the same.

teodorlu commented 5 months ago

@borkdude I think this looks good now–mind giving a second review?

borkdude commented 5 months ago

Ah that makes sense

https://www.michielborkent.nl https://www.eetvoorjeleven.nu

On Wed, 12 Jun 2024 at 16:28, Teodor Heggelund @.***> wrote:

I don't think I'd want to type neil dep pin foobar/foobar which is about the same, if not more effort than just editing the deps.edn.

Note: the behavior change i implemented did not add a new subcommand, but an optional argument :pin to neil dep add. Similar, but not exactly the same.

— Reply to this email directly, view it on GitHub https://github.com/babashka/neil/pull/228#issuecomment-2163159440, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFSBRRXZ3XW322JFT3D33ZHBLHXAVCNFSM6AAAAABJGK53TWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRTGE2TSNBUGA . You are receiving this because you commented.Message ID: @.***>