Fork me on GitHub
#cljsrn
<
2020-05-06
>
Oliver George01:05:09

Not sure what the cause of your error is. I'm surprised if it crashes if you follow the tutorial carefully.

Oliver George01:05:24

But I can tell you why, after the error, it ends in an odd state

Oliver George01:05:42

Essentially the RN strategy is to unmount your app if you don't catch the error.

Oliver George01:05:55

Krell doesn't do that for you, you can write a little app wrapper and do that yourself.

Oliver George01:05:18

(Or my quick assessment of your problem is wrong... I'm shooting from the hip)

Oliver George01:05:10

@adamtait starting fresh with clojurescript and react native at the same time is bold.

Oliver George01:05:23

Krell is still pre-alpha really.

Oliver George01:05:39

Good to avoid re-natal in my opinion. That's getting long in the tooth.

Oliver George01:05:51

Krell should be a great solution. Not far from having all it needs.

Oliver George01:05:07

Shadow CLJS is another option which I just haven't used but is popular.

adamtait04:05:22

Thanks @olivergeorge. I hadn’t thought about adding an exception handler; both your notes and code were very helpful.

adamtait04:05:54

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 ""
                  :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.

Oliver George05:05:21

Well done. Yeah, I'm running the latest sha too.

dnolen13:05:43

I'll point to the latest sha, thanks

joshmiller16:05:46

As discussed yesterday, I got a decent amount of the way to connecting Emacs-Cider-nREPL-Krell, but not the whole way.

joshmiller16:05:02

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)

dotemacs16:05:07

I’ll share what I’ve done, but still not 100% either

👍 4
joshmiller16:05:40

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"))

joshmiller16:05:39

What I definitely am not able to do is trigger a compile (the equivalent of the -c option for krell/cljs.main)

dotemacs16:05:12

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 🙂

dotemacs17:05:21

(Edited the above ☝️ as you need to specify custom REPL type at the prompt).

joshmiller17:05:13

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.

dnolen18:05:23

@joshmiller sounds like you got it working? I don't know what you mean by -c

dnolen18:05:26

that's not a REPL feature

dnolen18:05:17

Krell hot-reload now recompiles direct dependents, can be configured to recompile all dependents

👍 4
joshmiller18:05:21

@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.

dnolen18:05:45

right Krell doesn't do that, it's not like Figwheel and I'm unlikely to add anything like it

dnolen18:05:12

Krell is just a simple REPL - you can compile things in the usual way - that's it - no extras stuff besides hot loading

dnolen18:05:41

also you don't need two steps

dnolen18:05:47

same as ClojureScript

dnolen18:05:58

clj -m krell.main -co build.edn -c -r

dnolen18:05:05

that compiles then starts a REPL

dnolen18:05:36

(I was interpreting your comment as being able to start a build once the REPL is up)

joshmiller18:05:43

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.

dnolen19:05:24

I don't think you need nREPL to do this

dnolen19:05:23

what you're missing is a simple Krell fn to start a build

joshmiller19:05:55

So before I piggieback on krell.repl/repl-env I should have something to kick the build off, at the Krell level?

dnolen19:05:51

an easy one I'll try to add it tomorrow

👍 12
joshmiller19:05:03

Awesome, thanks

joshmiller19:05:07

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.

Oliver George23:05:59

I think there's a bug in loading repl-options from an EDN file but I might be doing something wrong.

Oliver George23:05:44

[email protected] krell-repros % cat repl-options.edn 
{:recompile :all}
[email protected] 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  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)