Fork me on GitHub

We now have a dual-implementation component at work! An http-client interface with implementations based on Hato (what we're moving to) and httpkit (what our legacy app still needs to use). Very slick how that works in Polylith. But it did raise a question: it seems that profiles only work with :extra-paths -- you can't use :extra-deps (with :local/root) because poly complains: "Error 107: Missing components in the development project for these interfaces: http-client". Is that a bug or just legacy behavior surfacing @tengstrand?


For context, I ended up with:

:+default {:extra-deps {;; by default, we use Hato:
                          poly/http-client-hato {:local/root "components/http-client-hato"}}
             ;; seems like a bug that we still need to specify _paths_?
             :extra-paths ["components/http-client-hato/src"

  :+httpkit {:extra-deps {;; but we can switch to the http-kit version:
                          poly/http-client-httpkit {:local/root "components/http-client-httpkit"}}
             ;; seems like a bug that we still need to specify _paths_?
             :extra-paths ["components/http-client-httpkit/src"


That must be a bug.


Good to know, thanks!

👍 1

What is the current story vis-a-vis the poly tool in projects with mixed clj/cljs/cljc?


I guess you want to share .cljc files between Clojure and ClojureScript code?


for context, about 1/3 to 1/2 of our codebase is CLJC


This is a question that comes up regularly. One idea is to put the backend workspace in a subdirectory under the git root, and then to have another directory at the same level with the frontend code. Then you need to decide where to put the .cljc code. Here I think you have two choices: 1. let it live in the backend directory 2. let it live in a third separate directory at the same level as the first two. Regardless which way you choose, you could be able to share the cljc code as “library source code” by importing it using the :local/root syntax. Some people have put all their frontend code in a base, but I have never tried that myself and I’m not sure I like it, but if it works it works! I may have missed some options too, so let’s see if there are any other answers out there!


When I ventured back into cljs (after a five or six year break) my approach was to try to write as much as possible of the front end in .cljc files with as little conditional code as possible and have just the pure UI portion in .cljs files. And then the pure backend stuff in .clj obvs. If I was using Polylith for such an app, I'd probably use a base for the pure UI stuff and have all the rest in components since that feels like it would match the architecture for a (backend) web app in the same architecture.


This will probably happen at work at some point. I have a green light to rewrite our last legacy app as a full stack cljs/clj app -- but it won't happen until I've finished rewriting our second-to-last legacy app as a backend Clojure app!


Upon a closer look at requirements - to do this properly I might need to do bases in python/JS as well, components maybe useful as well

Ziad Salah10:10:11

Congrats on the new release! Got a very minor issue to report with regards to the documentation in gitbook. I'm using Firefox on Ubunutu 18.04.6 and for some reason I'm unable to copy multiple lines at once from the code snippets (Nor does the copy helper icon work). I can only do it one line at a time. I did try chrome out of curiosity and it seems to work okay there. I know it's no big deal but figured it wouldn't hurt to mention it 🙂

Ziad Salah11:10:39

FYI it seems to be a gitbook/firefox issue rather than something to do with how you've used it.


Thanks! It could be worth mentioning in the doc + inform the creator of gitbook.

👍 1

I tried on my MacBook Pro with Big Sur 11.6 with these browsers: • Safari - worked • Chrome - worked • Edge - worked • Firefox - didn’t work! I will update the documentation with the advice that the user should use the copy icon, because copying the text directly never works for me! Also that they should try another browser if it doesn’t work!

Ziad Salah15:10:14

Yeah it's annoying that it doesn't work on Firefox but at least you've warned people now. Should hopefully reduce the friction a bit.


Yes. Let’s see if they fix it. I have informed them.

👍 1

Got this answer back: Thank you for reporting this. It is a known issue and we are going to fix it.

👍 1