babashka / neil

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

`neil dep upgrade`: upgrade unstable versions to more recent unstable versions (attempt 2) #187

Closed teodorlu closed 1 year ago

teodorlu commented 1 year ago

A fresh take on #179 , moving slower and leaning more heavily on tests for development.

  1. Stable versions are only upgraded to more recent stable versions
  2. For unstable versions,
    1. A more recent stable version is preferred,
    2. Otherwise, a more recent unstable version is selected.

I added a :dev alias to deps.edn for working with tests from the REPL. I can remove it if needed.

I also made some changes to existing tests, and added some new one. I think it's easier to understand what the code does from reading the tests now.


For a library with the following available versions: 1.0.1-alpha1, 1.0.1-alpha2, 1.0.1, 1.0.2, 2.0.0-alpha1, 2.0.0-alpha2, before this PR, we would see this behavior:

After this PR, we would see this behavior:

teodorlu commented 1 year ago

Looks like the CI failures above were:

  1. network instability
  2. a linter error for an unused binding.
teodorlu commented 1 year ago

I think I've got it working now.

  1. Stable clojars/maven versions will only upgrade to more recent, stable versions.
  2. Unstable clojars/maven versions will first look for a more recent, stable version. If a more recent, stable version is not found, it will look for a more recent unstable version.

For git deps, I skipped some work. If the same version as the current version is found, we don't upgrade.

teodorlu commented 1 year ago

@borkdude I'm happy with this PR now. Mind taking a look?

borkdude commented 1 year ago

@teodorlu Thanks. I've been thinking, perhaps we could also have an --unstable flag to upgrade to the latest unstable version?

teodorlu commented 1 year ago

Agreed, an --unstable flag would be useful!

teodorlu commented 1 year ago

Added support for --unstable in #188.

Note: the latest version whatsoever is picked, so if a stable version is the latest version, that stable version will still be picked.