Hi @adamtait
Not sure what the cause of your error is. I'm surprised if it crashes if you follow the tutorial carefully.
But I can tell you why, after the error, it ends in an odd state
Some notes here: https://gist.github.com/olivergeorge/8ec1a8ea45a2a607f43a918127d29fa9
Essentially the RN strategy is to unmount your app if you don't catch the error.
Krell doesn't do that for you, you can write a little app wrapper and do that yourself.
(Or my quick assessment of your problem is wrong... I'm shooting from the hip)
@adamtait starting fresh with clojurescript and react native at the same time is bold.
Krell is still pre-alpha really.
Good to avoid re-natal in my opinion. That's getting long in the tooth.
Krell should be a great solution. Not far from having all it needs.
Shadow CLJS is another option which I just haven't used but is popular.
Thanks @olivergeorge. I hadn’t thought about adding an exception handler; both your notes and code were very helpful.
I was able to solve the problem by updating deps.edn
to reference the most recent io.vouch/krell
sha, rather than the sha included in the wiki tutorial.
io.vouch/krell {:git/url "<https://github.com/vouch-opensource/krell.git>"
:sha "00b46eaf9e973d62444d09e2dee43b6bb7b3c318"}
The exception stack trace failed at https://github.com/vouch-opensource/krell/blob/master/resources/krell_repl.js#L148 but eventually led me to https://github.com/vouch-opensource/krell/blob/master/resources/krell_repl.js#L262, which it looked to have been updated recently.
Hope this is helpful, in case anyone else runs into the same issue.Well done. Yeah, I'm running the latest sha too.
I'll point to the latest sha, thanks
As discussed yesterday, I got a decent amount of the way to connecting Emacs-Cider-nREPL-Krell, but not the whole way.
I can start up nrepl with clj -Sdeps '{:deps {nrepl {:mvn/version "0.6.0"} refactor-nrepl {:mvn/version "2.4.0"} cider/cider-nrepl {:mvn/version "0.22.0-beta8"}}}' -m nrepl.cmdline --middleware '["refactor-nrepl.middleware/wrap-refactor", "cider.nrepl/cider-middleware"]'
(mostly just copied from cider-jack-in)
I’ll share what I’ve done, but still not 100% either
Then I can connect to the simulator with: (require '[cider.piggieback] '[krell.repl])
and (cider.piggieback/cljs-repl (krell.repl/repl-env :port 5001 :watch-dirs ["src"] :connect-timeout 30000 :output-dir "target"))
What I definitely am not able to do is trigger a compile (the equivalent of the -c
option for krell/cljs.main)
This is wrong, but this is where I got up to, and then didn’t bother poking further:
eval this in Emacs: (setq cider-custom-cljs-repl-init-form "(do (require 'cljs.main) (require 'krell.repl) (cider.piggieback/cljs-repl (cljs.main/-main \"-re\" \"krell.repl\" \"-co\" \"build.edn\" \"-c\" \"-r\")))")
M-x cider-jack-in-cljs
When the REPL starts, it prompts you for the REPL type, at which point I choose custom
and then for the device number.
Then the REPL is mangled, as in you still see user>
and you keep constantly seeing Stdin:
prompt in the minibuffer which passes the values to cljs.user=>
prompt.
Obviously, this is not working correctly, but I don’t really have the time to figure it out.
So maybe somebody can look at this, and go ewww, and create the correct setup and share it here 🙂
(Edited the above ☝️ as you need to specify custom
REPL type at the prompt).
Yeah, I hit that, and I assume that’s because the cljs.main REPL env uses stdin for input, so that’s why I ended up where I did with the krell.repl/repl-env
.
@joshmiller sounds like you got it working? I don't know what you mean by -c
that's not a REPL feature
Krell hot-reload now recompiles direct dependents, can be configured to recompile all dependents
@dnolen I mean that I can’t kick off a compile when starting up the REPL, so need to do it in a second step. But maybe the hot-reload step can handle that for me.
right Krell doesn't do that, it's not like Figwheel and I'm unlikely to add anything like it
Krell is just a simple REPL - you can compile things in the usual way - that's it - no extras stuff besides hot loading
also you don't need two steps
same as ClojureScript
clj -m krell.main -co build.edn -c -r
that compiles then starts a REPL
(I was interpreting your comment as being able to start a build once the REPL is up)
Right, but I’m starting nREPL instead of krell.main, so the -c opt isn’t being passed along to cljs.main. I was trying to find a way to do that all in one go.
I don't think you need nREPL to do this
Aha, ok
what you're missing is a simple Krell fn to start a build
So before I piggieback on krell.repl/repl-env
I should have something to kick the build off, at the Krell level?
yes
an easy one I'll try to add it tomorrow
Awesome, thanks
I think that compile fn will need to accept the compile-opts
being passed to cljs.main as well (what’s in build.edn
in a basic Krell app); if I’m wrong and that should be provided elsewhere, let me know.
yep
I think there's a bug in loading repl-options from an EDN file but I might be doing something wrong.
olivergeorge@Condense-iMac krell-repros % cat repl-options.edn
{:recompile :all}
olivergeorge@Condense-iMac krell-repros % clj -m krell.main -ro repl-options.edn -co build.edn -v -c -r
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See <http://www.slf4j.org/codes.html#StaticLoggerBinder> for further details.
java.lang.IllegalArgumentException: No value supplied for key: [:recompile :all]
at clojure.lang.PersistentHashMap.create(PersistentHashMap.java:77)
at krell.repl$repl_env.invokeStatic(repl.clj:445)
at krell.repl$repl_env.doInvoke(repl.clj:445)
Seems like the bug is in the arg handling for the repl-env
function here: https://github.com/vouch-opensource/krell/blob/48a58298a1af8e4c09d37b015a143b71ecdf6b7f/src/krell/repl.clj#L447