hagmonk / find-deps

tools.deps friendly utility for searching clojars and maven
63 stars 11 forks source link

Hide SNAPSHOT versions by default #2

Closed pesterhazy closed 6 years ago

pesterhazy commented 6 years ago

Great project!

By default, find-deps returns SNAPSHOT versions:

$ clj -A:find-deps reagent
{:deps {reagent/reagent {:mvn/version "0.8.2-SNAPSHOT"}}}

These are mutable prereleases, and should be avoided unless you're know what you're doing. Maybe find-deps should hide SNAPSHOT versions by default, perhaps with an option to include them?

hagmonk commented 6 years ago

Thanks for the issue! I agree they should be hidden by default. I'm looking at this right now …

hagmonk commented 6 years ago

Frustratingly, the clojars API doesn't appear to have any arguments to exclude snapshot versions. They simply return:

{:description "A simple ClojureScript interface to React",
 :created "1527436309000",
 :jar-name "reagent",
 :group-name "reagent",
 :version "0.8.2-SNAPSHOT"}

I'm digging through the clojars-web source code to see if I'm missing something. Failing that, I could implement a fallback does a second http query against clojars to get the last non-SNAPSHOT version.

hagmonk commented 6 years ago

@pesterhazy I just merged a fix for this, let me know if it works for you. Right now there's no option to turn snapshots back on, for the time being I'm just eliding them.

I'm just taking the latest release version as given by clojars via a second API call. I elected to keep the timestamp given by the snapshot'd version, since that timestamp is only used for project ranking, and I think when ranking results I'd probably consider a more recent snapshot as a sign of a more "active" project and therefore of higher interest.