Hi all,
I’ve been practicing my Clojure skills by writing a simple react native app. Just a simple thing with two views, a notification and a bit of navigation, to get the feel for it.
So far I’ve not invested the energy in connecting to a repl from my favourite editor, and instead relied on typing in some commands in the repl to experiment before writing the final version of the code in the .cljs file. However, recently I tried connecting to a repl from Conjure, and I just cannot get it to work. This is frustrating me a lot, because emotionally I don’t want to go back to typing in the repl. Does someone know where I should look for the problem?
This is what I used to do (and what works)
Basically the steps from the readme
-
clj -M -m krell.main -co build.edn -c -r
after a couple of seconds this shows ‘waiting for device connection on port 5001’, and then: npx react-native start
-
npx react-native run-android
Leads to a succesful running of the app with a connected interactive repl (command line).
Help
(See below for the two things I’ve tried to get to work. But first my question, for comfort of the reader.)
Does someone have either
- Some steps to produce a working setup for (n)vim + clojurescript + react-native?
- Some indication of what might be wrong, or where I should be looking? Is it the device connection that I should debug (even though it is working from
clj -M -m krell.main -co build.edn -c -r
), or should I be looking at the way Conjure connects to the clj repl?
Re point 1: I’m also fine with other build systems, or other (n)vim plugins. As long as I can continue focussing on my little app from the comforts of a vim environment
Attempt 1 (didn’t work)
- start a repl using
clj -M:cider-krell
with in my deps.edn:
:cider-krell {:extra-deps {org.clojure/clojure {:mvn/version "1.10.3"}
cider/cider-nrepl {:mvn/version "0.26.0"}
cider/piggieback {:mvn/version "0.5.2"}
io.vouch/krell {:git/url "https://github.com/vouch-opensource/krell.git"
:sha "08f2bfea96aa48feb8511851e37f5948453986e5"}
io.vouch/reagent-react-native {:git/url "https://github.com/vouch-opensource/reagent-react-native.git"
:sha "0fe1c600c9b81180f76b94ef6004c2f85e7d4aa0"}
- open nvim + conjure, connect to this repl, and send the code from the wiki:
(require '[clojure.edn :as edn]
'[clojure.java.io :as io]
'[cider.piggieback]
'[krell.api :as krell]
'[krell.repl])
(def config (edn/read-string (slurp (io/file "build.edn"))))
(apply cider.piggieback/cljs-repl (krell.repl/repl-env) (mapcat identity config))
- Now I see the output
and this ‘waiting for device to connection on port 5001’ is the same as what I’m getting in my working setup. But, now runningnpx react-native start
andnpx react-native run-android
does not yield a repl I can send more commands to, there will be simply no response:
Attempt 2
Basically the instructions from the calva help page at: Krell - Calva User Guide
I have the feeling that a couple of days ago this did in fact work for me (attempt 1 never worked at all). But now I can’t reproduce it anymore (even after a restart of the system). Now it yields the same behaviour as at attempt 1
Thanks in advance for any help!
Florian