Fork me on GitHub
#babashka
<
2023-11-26
>
martinklepsch14:11:46

Hey there! I'm experimenting with packaging code transforms with dependencies and I was thinking of using a similar mechanism as clj-kondo.exports to expose some babashka code from within a dependency. I tried getting some inspiration for how to set this up from clj-kondo but I wasn't quite able to understand how those directories are "added to the classpath" in a way where they can then be required... Curious if anyone has pointers for how this could be achieved?

borkdude14:11:11

Why do you need a separate mechanism from what bb already has?

martinklepsch14:11:22

Actually, maybe I just don't? My goal is to package package something like "install hooks" with libraries and I guess I wanted to somehow isolate those sources from the actual library code.

martinklepsch14:11:34

But also if I just package them alongside the regular sources, how would I discover those namespaces?

borkdude14:11:33

You could use a specific extension or prefix ?

borkdude14:11:56

And then use io/resource to find it

borkdude14:11:14

Or whatever else you need to find stuff on the classpath

martinklepsch14:11:03

Yeah I guess that should work 🙂

martinklepsch14:11:56

Thanks! 🙂

martinklepsch14:11:33

Has it ever been considered to package a formatter with babashka? 😄

borkdude14:11:43

Cljfmt works with bb

borkdude14:11:56

As a dependency

martinklepsch14:11:11

Ah, that's neat!