Fork me on GitHub
#shadow-cljs
<
2019-01-23
>
jstaab18:01:05

Is there a way to get a socket repl for my cljs build that I can use remotely (I'm trying to make a plugin for kakoune)? I can netcat to the socket repl and start a shadow repl, but it appears to back me out to the top-level repl when I run further commands:

➜  core git:(cljs) ✗ echo "(shadow/repl :test)" | nc localhost 58218
shadow-cljs - REPL - see (help)
To quit, type: :repl/quit
[10:0]~shadow.user=> [10:1]~cljs.user=> nil
[10:0]~shadow.user=> %                                                                                                
➜  core git:(cljs) ✗ echo "(prn :x)" | nc localhost 58218
shadow-cljs - REPL - see (help)
To quit, type: :repl/quit
[11:0]~shadow.user=> :x
nil
[11:0]~shadow.user=> % 

souenzzo18:01:50

can shadow-cljs accept output-dir from CLI? something like clj -A:shadow-cljs -m shadow.cljs.devtools.cli release prod --output-dir "resource/public" ?

thheller21:01:54

@jstaab if you nc an echo it will end with closing stdin which means closing the REPL

thheller21:01:33

if you open a regular socket and keep sending normally it will keep you in the REPL

thheller21:01:04

@souenzzo that is not supported by default. you can either use :release specific config or use clj-run though

thheller21:01:21

(defn release [path]
  (-> (shadow/get-build-config :your-build-id)
      (assoc :output-dir path)
      (shadow/release* {})))

👍 5
thheller21:01:35

shadow-cljs run your.util/release resource/public

thheller21:01:48

@jstaab I plan on adding support for prepl this weekend, probably better suited if you want to build tools on top of it

jstaab22:01:05

@thheller awesome, thanks for the tip! Also, from what I've seen of prepl, it looks way nicer to code against. Thanks for your hard work!