Description
Hi, It would be great if there was a section on the ClojureScript docs about setting up a "fullstack" cider environment for clojure and clojurescript. I was able to make it work with figwheel-main and tools.deps, but I know it is possible to do so with other tools combinations like shadow-cljs and lein.
I read both cider.mx and figwheel-main docs and couldn't figure out how to setup a project such I could use cider-jack-in-clj&cljs
. I wanted to run some clojure API plus a cljs client. The final solution that I found involved using a ring-middleware for the API, but I think after digging around I would be able to do it with an stand-alone clojure server... (maybe,,, :-).
In the process of attempting this, I followed some pointers into other documentation sites including nrepl's, lambda island repl site and dirac's repl diagrams.
Before reading this I wasn't sure what was going on with the "fullstack" setup... I slowly began to unravel what (I think) was going on...
- I wasn't sure if I needed an nREPL process for clj and another for cljs, but now I think we only need one since the single nREPL server can be setup to handle both environments (piggieback involved in "routing" to cljs).
- I tried to setup a script manually stitching info from figwheel-main and cider site, but since I was trying to setup two nREPLs servers from the same script, I was confused and I wasn't able to make it work.
- I wanted to somehow configure which port the nREPL server would be running on, but figwheel-main does not allow that as far as I can tell... Later I found that nrepl.cmdline is involved on the processes (not mention in either doc sites), and is the code that generates that .nrepl-port file on the root of the project.
- In the end I found and forked a repo that was setup properly , ran
cider-jack-in-clj&cljs
command, and things just worked! I'm pretty sure the difference with everything that I tried before was a proper setup of .dir-locals.el, which is mentioned in different places in cider.mx docs but I did not draw the picture from the dots.
Finally, here are some quasi monologues I followed in the process of learning all this:
https://clojurians.slack.com/archives/C0617A8PQ/p1580935503106500
https://clojurians.slack.com/archives/CALJ3BFLP/p1580899631068000