Fork me on GitHub
Oliver George01:05:57

Yeah, I'm not demonstrably a muppet this time. Needs to be "-c -r" to generate it though. I'll log a bug.


untested but I believe everything is in place


Thanks for that @dnolen I’ll give it a spin right away


feel free report any tweaks this needs


I won't be able to help out wrt. to actually trying this, busy with other stuff - but I don't think there's anything missing to make it work

👍 4

krell.api/build is generally useful for scripts


(krell.api/build :some-build {:verbose true} "more_opts.edn") works


all options merged left to right


The first thing that is missing is '[ :as io] in the :require clause, as io is used.


fixed thanks


This is what happens. I eval this in Emacs:

(setq cider-custom-cljs-repl-init-form
      "(require '[cider.piggieback]
         '[ :as io]
         '[krell.api :as krell]

(def config (slurp (io/file \"build.edn\")))
(krell/build config)
(apply cider.piggieback/cljs-repl (krell.repl/repl-env) (mapcat identity config))")
From the root of the project, where deps.edn is, I run M-x cider-jack-in-cljs, which runs:
/usr/local/bin/clojure -Sdeps '{:deps {nrepl {:mvn/version "0.6.0"} cider/piggieback {:mvn/version "0.4.2"} refactor-nrepl {:mvn/version "2.4.0"} cider/cider-nrepl {:mvn/version "0.24.0"}}}' -m nrepl.cmdline --middleware '["refactor-nrepl.middleware/wrap-refactor", "cider.nrepl/cider-middleware", "cider.piggieback/wrap-cljs-repl"]'
Then I’m prompted what REPL type I want, and I type custom. The REPL starts, and this is returned:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See  for further details.
nil#'user/configFileNotFoundException {:main awesome-project.core
:output-to "target/main.js"
:output-dir "target"}
(No such file or directory)  .FileInputStream.open0 (
IllegalArgumentException Don't know how to create ISeq from: java.lang.Character  clojure.lang.RT.seqFrom (


need to see a full stracktrace - no much use otherwise

dotemacs16:05:51  550  clojure.lang.RT/seqFrom
           530  clojure.lang.RT/seq
                  core.clj:  137  clojure.core/seq
                  core.clj:  717  clojure.core/concat/fn
       40  clojure.lang.LazySeq/sval
       49  clojure.lang.LazySeq/seq
           528  clojure.lang.RT/seq
                  core.clj:  137  clojure.core/seq
                  core.clj:  726  clojure.core/concat/cat/fn
       40  clojure.lang.LazySeq/sval
       49  clojure.lang.LazySeq/seq
          39  clojure.lang.Cons/next
          1785  clojure.lang.RT/boundedLength
       130  clojure.lang.RestFn/applyTo
                  core.clj:  659  clojure.core/apply
                  core.clj:  652  clojure.core/apply
                      REPL:    8  user/eval21162
                      REPL:    8  user/eval21162
    7062  clojure.lang.Compiler/eval
    7025  clojure.lang.Compiler/eval
                  core.clj: 3206  clojure.core/eval
                  core.clj: 3202  clojure.core/eval
                  main.clj:  243  clojure.main/repl/read-eval-print/fn
                  main.clj:  243  clojure.main/repl/read-eval-print
                  main.clj:  261  clojure.main/repl/fn
                  main.clj:  261  clojure.main/repl
                  main.clj:  177  clojure.main/repl
      1523  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   79  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:   55  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:  142  nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
           22  clojure.lang.AFn/run
               session.clj:  171  nrepl.middleware.session/session-exec/main-loop/fn
               session.clj:  170  nrepl.middleware.session/session-exec/main-loop
           22  clojure.lang.AFn/run
       834  java.lang.Thread/run


this is why I don't use nREPL


oh another bug in the code I wrote


@dnolen It’s working for me over here, thanks for the update


I can confirm that it works for me too! Thanks @dnolen


Working steps: Eval this in Emacs:

(setq cider-custom-cljs-repl-init-form
      "(require '[ :as io]
         '[clojure.edn :as edn]
         '[krell.api :as krell]

(def config (edn/read-string (slurp (io/file \"build.edn\"))))
(krell/build config)
(apply cider.piggieback/cljs-repl (krell.repl/repl-env) (mapcat identity config))")
M-x cider-jack-in-cljs When prompted for the REPL type provide custom. The REPL will start and you’ll see user> Start the simulator: react-native run-ios. Once the the connection is established, the REPL prompt will change to: cljs.user>.


@dotemacs Any idea if we can set the REPL type automatically to skip that step?


If by “automatically” you mean we write a custom .dir-locals.el which will set that variable for us, then yes 🙂 But on the serious note, we should submit a patch that runs that step for us when it detects Krell.


Heh, I was already putting the cljs-repl-init form into .dir-locals.el


The same way it does it for the other tools, like for shadow-cljs…


Do you know which cider variable sets that repl type? I’m paging through the 8 million of them and not seeing anything off the top of my head.


I’m trying to find the place where it’s configured for other tools… digging around on GitHub right now…

👍 4

glad it's working!

👏 8

The way I see it, you can tell easily if a project is lein, boot, shadow-cljs… based, simply based on the config file: project.clj, boot…, deps.edn, shadow-cljs.edn. But for krell, I guess we have to see if it’s a dependency …


Ah, I see. I was just looking to set the repl type to custom, this would skip that step entirely.


I get you. But I was hoping that there could be a “smart” step within CIDER that would figure out if it’s a Krell based project and then just inject the dependency. If it can’t figure it out, then it would revert to prompting the user…


I mean, you could rename build.edn in your project to krell-build.edn and look at that, but then you have to explain the difference to official docs.


I guess that could be an option.


But for now, I guess we could “suffer” this manual approach and see if that will be painful enough to warrant a PR…


I’m going to commit the current setup to a blog post so it doesn’t get lost to the sands of Slack.

👍 8

I created this issue to start a discussion:


thanks for writing that up

👍 4

But it was @dnolen who did all the work, so all kudos to him 🙂

👍 4

I’m just mentioning that in reference to your blog post @joshmiller because you gave me credit 🙂


Maybe you can amend it and also add cider-cljs-repl-type set to custom?


Tried that, no dice on skipping the repl type selection step.

👍 4

@joshmiller this works, after adding it to .dir-locals.el:

((nil . ((cider-default-cljs-repl . custom)
         (cider-custom-cljs-repl-init-form . "(require '[ :as io]
         '[clojure.edn :as edn]
         '[krell.api :as krell]
(def config (edn/read-string (slurp (io/file \"build.edn\"))))
(krell/build config)
(apply cider.piggieback/cljs-repl (krell.repl/repl-env) (mapcat identity config))"))))
you can just C-c M-J. You won’t get prompted for anything.

👍 4

Oh cool, let me try that


That works, I’ll update.

👍 4

I would love to hear if anyone has tips/scripts on making an iOS archive from a Krell app? It seems that re-natal has a complicated story based on leiningen for building publish-able archives. Unfortunately, the tip hasn’t helped me; I haven’t seen a main.js being built and iOS archives result in an app waiting for the Krell repl socket.


ha I keep asking questions then fixing them myself shortly after. In case anyone has similar questions, this process seems to work:

clj -Srepro -m krell.main -v -co build.edn -O advanced -c
npx react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'
# finally, run standard build/archive process in XCode following 

👍 4