Fork me on GitHub
#chlorine-clover
<
2020-03-28
>
athomasoriginal15:03:01

Is it possible to connect chlorine to a repl created via the clj CLI tool? For example, if I have a REPL started via:

clj --main cljs.main --compile app --repl
I don’t think I can connect chlorine to the above, but is it possible to start the above as a socket repl and then connect chlorine?

athomasoriginal15:03:27

Just thought i would ask before I dig into the code 😉

mauricio.szabo16:03:08

Yes, it is possible. There are examples on the project's README.

mauricio.szabo16:03:40

In fact, I don't think any tool starts a socket repl by default, only nRepl :)

athomasoriginal23:03:39

Sorry, I meant I a ClojureScript repl…should have clarified

mauricio.szabo00:03:09

Ah, OK :). There is a command to open a specific socket repl for ClojureScript (on the browser, on nashorn, or node I think). Then you can connect to then, it's only a little limited in functionality. I'll look up these commands for you :)

mauricio.szabo00:03:25

(and also add then in the README too :D)

mauricio.szabo00:03:01

Okay, found it: you can start a ClojureScript socket REPL with the following command, for example:

clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.597"}}}' -J-Dclojure.server.browser="{:port 4444 :accept cljs.server.browser/repl}"

mauricio.szabo00:03:20

When you ask Chlorine to connect to port 4444, it'll start a browser and connect a REPL to it

athomasoriginal16:03:43

Yup, that does it!