cljsrn

https://github.com/drapanjanas/re-natal | https://github.com/drapanjanas/re-natal/wiki/FAQ | https://github.com/condense/mercury-app/wiki | https://github.com/seantempesta/expo-cljs-template/ https://www.npmjs.com/package/create-expo-cljs-app
Oliver George 2020-05-06T01:48:48.470800Z

Hi @adamtait

Oliver George 2020-05-06T01:49:09.471300Z

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

Oliver George 2020-05-06T01:49:24.471800Z

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

Oliver George 2020-05-06T01:49:28.472Z

Some notes here: https://gist.github.com/olivergeorge/8ec1a8ea45a2a607f43a918127d29fa9

Oliver George 2020-05-06T01:49:30.472200Z

Oliver George 2020-05-06T01:49:42.472800Z

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

Oliver George 2020-05-06T01:49:55.473200Z

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

Oliver George 2020-05-06T01:50:18.473700Z

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

Oliver George 2020-05-06T01:53:10.474400Z

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

Oliver George 2020-05-06T01:53:23.474800Z

Krell is still pre-alpha really.

Oliver George 2020-05-06T01:53:39.475200Z

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

Oliver George 2020-05-06T01:53:51.475600Z

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

Oliver George 2020-05-06T01:54:07.476Z

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

adamtait 2020-05-06T04:48:22.477600Z

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

adamtait 2020-05-06T04:53:54.480200Z

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.

Oliver George 2020-05-06T05:52:21.481Z

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

dnolen 2020-05-06T13:14:43.485200Z

I'll point to the latest sha, thanks

joshmiller 2020-05-06T16:35:46.485900Z

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

joshmiller 2020-05-06T16:36:02.486400Z

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)

dotemacs 2020-05-06T16:36:07.486600Z

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

👍 1
joshmiller 2020-05-06T16:36:40.487100Z

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

joshmiller 2020-05-06T16:37:39.487800Z

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

dotemacs 2020-05-06T16:59:12.491700Z

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&gt; and you keep constantly seeing Stdin: prompt in the minibuffer which passes the values to cljs.user=&gt; 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 🙂

dotemacs 2020-05-06T17:04:21.492500Z

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

joshmiller 2020-05-06T17:19:13.493600Z

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.

dnolen 2020-05-06T18:07:23.494100Z

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

dnolen 2020-05-06T18:07:26.494300Z

that's not a REPL feature

dnolen 2020-05-06T18:22:17.495Z

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

👍 1
joshmiller 2020-05-06T18:41:21.495900Z

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

dnolen 2020-05-06T18:49:45.496300Z

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

dnolen 2020-05-06T18:50:12.496900Z

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

dnolen 2020-05-06T18:50:41.497200Z

also you don't need two steps

dnolen 2020-05-06T18:50:47.497500Z

same as ClojureScript

dnolen 2020-05-06T18:50:58.497900Z

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

dnolen 2020-05-06T18:51:05.498100Z

that compiles then starts a REPL

dnolen 2020-05-06T18:51:36.498500Z

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

joshmiller 2020-05-06T18:53:43.499400Z

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.

dnolen 2020-05-06T19:01:24.499800Z

I don't think you need nREPL to do this

joshmiller 2020-05-06T19:02:25.000600Z

Aha, ok

dnolen 2020-05-06T19:03:23.001200Z

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

joshmiller 2020-05-06T19:04:55.001900Z

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

dnolen 2020-05-06T19:05:13.002100Z

https://github.com/vouch-opensource/krell/issues/79

dnolen 2020-05-06T19:05:28.002400Z

yes

dnolen 2020-05-06T19:05:51.002900Z

an easy one I'll try to add it tomorrow

👍 3
joshmiller 2020-05-06T19:06:03.003200Z

Awesome, thanks

joshmiller 2020-05-06T19:25:07.004500Z

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.

dnolen 2020-05-06T20:03:55.004700Z

yep

Oliver George 2020-05-06T23:53:59.005400Z

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

Oliver George 2020-05-06T23:54:44.005700Z

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)

Oliver George 2020-05-06T23:55:26.006200Z

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