Using the Boot-clj REPL to load Clojurescript functions in a Castra/Hoplon project

172 views Asked by At

I am having quiet a bit of trouble with the boot-clj nREPL. I connect using cider-jack-in in EMACS and then at the top it displays the correct port and on the bottom it shows 'boot.user=>' but I am having trouble loading cljs functions from the '../rpc.cljs' page. In short I don't have any idea how to navigate to that place. I tired using '(load "...")' but I can't even figure out the current working directory. I couldn't find a tutorial on using the Boot REPL anywhere. I have tried it from the command line with 'boot repl' then loading with '(def p (future (boot (dev))))' but still am completely lost.

So in short, could someone help point me in the right direction? I am looking for how to change the current directory, finding the current working directory, and loading functions from a .cljs file.

:::EDIT::: I found the boot-cljs-repl and tried to hook that up. In a Hoplon/Castra template it is already included in the 'build.boot' file but, after following the directions on their GitHub it still doesn't work. To connect it to the project add the below in the 'build.boot' file, the second part is for the Boot Task 'Dev'

(require
   '[adzerk.boot-cljs-repl :refer [cljs-repl cljs-repl-env start-repl]]"
    ...

    ...
    (reload)
    (cljs-repl-env)
    (cljs)))
    ...

And then, you should be able to use cider-jack-in to load the CLJS repl with the commands '(def r (future (boot (dev))))' followed by (start-repl) but whenever I run that I have an error. I have tried cider-jack-in-clojurescript and the one before but it seems to have an error connecting to the CLJS repl.

boot.user> << started Weasel server on ws://127.0.0.1:38456 >>
           << waiting for client to connect ... 
           java.lang.NullPointerException
           at clojure.java.io$make_parents.invokeStatic(io.clj:443)
           at clojure.java.io$make_parents.doInvoke(io.clj:438)

I will keep trying different approaches but so far seem stuck.

:::EDIT:::

I figured out the problem some more, if you use '(cljs-repl)' instead of '(cljs-repl-env)' than you can connect with 'cider-connect' after you start 'boot dev' in bash, and then you type '(start-repl)' into the cider repl and it starts a CLJS repl. The problem I am now having is if I try and use the REPL like a Clojure REPL it doesn't quite work. If you press C-c C-c cider just says, if in a .cljs file, that it needs a Clojurescript REPL even though it is.

Cheers,

0

There are 0 answers