liquidz / antq

Point out your outdated dependencies.
Other
403 stars 25 forks source link

Use antq as a library #209

Closed tengstrand closed 1 year ago

tengstrand commented 1 year ago

Hi!

I'm considering using antq within the poly tool.

If we let the poly tool execute the libs command, it returns all the used libraries in the workspace, e.g.: image

My idea is to allow the user to also show the column outdated that will be populated if the library is out of date, by using antq internally.

I haven't digged into the code so much yet, but is it possible to use antq as a library, and let it return a data structure with all the outdated libraries, when called?

liquidz commented 1 year ago

@tengstrand Sorry for late reaction.

is it possible to use antq as a library

Unfortunately no for now. But it should be, so I'd like to add some APIs :)

pmonks commented 1 year ago

@tengstrand I'm (ab)using antq as a library here. It seems to work ok, despite being a little kludgy due to the entry points and args not being as well-defined as one might expect in a "real" library.

liquidz commented 1 year ago

antq.core/antq is available, but it has not been organized as an API as you know. So, I'm considering a new interface based on this function.

pmonks commented 1 year ago

@liquidz I suspect it won't take much, given how close the functionality already is! 🤞

liquidz commented 1 year ago

@tengstrand @pmonks Now I'm considering the API as follows. https://github.com/liquidz/antq/blob/9c7cc46e30929079d72c630b80c232fd7854bf12/src/antq/api.clj#L31-L32

The first argument deps-map is a map of the same form as :deps in deps.edn, so it seems easy to specify when used as a library in my opinion. How about this interface?

pmonks commented 1 year ago

@liquidz from my perspective that looks like a good start, though I think some of the other CLI options may also be handy to have available via the opts map second argument? For example all of the following seem useful:

I think there also needs to be a separate API that's equivalent to the upgrade CLI option (imvho it makes more sense to implement this as a separate fn in the API, rather than as an opt to outdated-deps - obvs that's not possible via a CLI, but an API can be more expressive).

liquidz commented 1 year ago

@pmonks Thanks for your advice :)

I think some of the other CLI options may also be handy to have available via the opts map second argument

Supported. https://github.com/liquidz/antq/blob/3414e7e0a3ca626dfea1f6b483abfd142d0b4164/src/antq/api.clj#L16

I think there also needs to be a separate API that's equivalent to the upgrade CLI option

Added. https://github.com/liquidz/antq/blob/3414e7e0a3ca626dfea1f6b483abfd142d0b4164/src/antq/api.clj#L33

Could you try dev branch?

tengstrand commented 1 year ago

The new api works really well! Thanks @liquidz

image
liquidz commented 1 year ago

@tengstrand Thanks for your confirmation! I just released v2.3.1043 :)

tengstrand commented 1 year ago

Switched to that version. Thanks @liquidz!