practicalli

James Amberger 2023-04-30T13:41:01.917669Z

I am afraid I still don't really get how to use clj. for instance I see that I can run a cljs/node repl with the practicalli deps.edn

practicalli-johnny 2023-04-30T14:55:37.802089Z

If using Clojure (rather than ClojureScript), then portal and rebel readline will automatically start with the following command

clojure -M:repl/reloaded
Portal will listen to all evaluations carried out over nREPL (e.g. a connected editor like Emacs CIDER, VSCode, Calva, Nvim Conjure, etc) Or use tap> around an expression to send that to Portal There is also a mulog publisher, so an event is sent to Portal too
(mulog/log ::meaningful-event-name :meaningful-key "some value, e.g. from a function call or local name" :more-keys "and values")

James Amberger 2023-04-30T13:41:27.047909Z

but what if I want to load portal and rebel-readline too, all from the cli invocation

practicalli-johnny 2023-05-01T09:33:03.190499Z

I believe the :repl/rebel-cljs alias only works with Java 8, as it uses libraries that were removed in newer Java versions. I'm experimenting with additional libraries to understand which is needed for Java 11 and Java 17

practicalli-johnny 2023-05-01T12:04:13.572589Z

I have this rather monsterous alias working for Java 11, although it will not work on newer versions of Java where the Nashorn JavaScript engine was removed - even if the openjdk nashorn library is added as a dependency

:repl/nrepl-figwheel
  {:extra-deps
   {org.clojure/clojurescript {:mvn/version "1.9.946"}
    nrepl/nrepl {:mvn/version "0.8.3"}
    cider/cider-nrepl         {:mvn/version "0.30.0"}
    cider/piggieback {:mvn/version "0.5.3"}
    org.slf4j/slf4j-nop {:mvn/version "1.7.30"}
    ;; org.openjdk.nashorn/nashorn-core {:mvn/version "15.4"}
    jakarta.xml.bind/jakarta.xml.bind-api {:mvn/version "2.3.2"}
    cljs-tooling/cljs-tooling {:mvn/version "0.3.1"}
    com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
    com.bhauman/figwheel-main {:mvn/version "0.2.17"}}
   :extra-paths ["target" "test"]
   :main-opts
   ["-m" "nrepl.cmdline"
    "--middleware" "[cider.nrepl/cider-middleware,cider.piggieback/wrap-cljs-repl]"
    "--interactive"
    "-f" "rebel-readline.cljs.main/-main"]}

practicalli-johnny 2023-05-01T12:06:10.489069Z

So for now, the simplest way to have Rebel Readline with ClojureScript, with Figwheel as the build tool, is to use the https://github.com/bhauman/figwheel-main-template and then launch a REPL using the aliases the project creates.

practicalli-johnny 2023-05-01T12:07:06.683319Z

I havent tried with Shadow-cljs yet, its lower down on my todo list as its going to require quite a bit of reading of the shadow-cljs user guide

James Amberger 2023-04-30T13:46:19.671329Z

Hmm maybe I figured it out?

clj -M:repl/cljs:repl/reloaded

practicalli-johnny 2023-04-30T14:45:34.607569Z

I haven't tried the reloaded workflow with ClojureScript yet, only with Clojure. Note: rebel-readline for Cljs reqiured a Java version that contains Nashorn (usually Java 14 or earlier) The inspect/portal-web alias if using fighweel-main or cljs-build, or :inspect/portal-node if using shadow-cljs may be more appropriate

clojure -M:inspect/portal-web:repl/cljs
Note that clj wrapper should not be used with rebel-readline as clj calls the rlwrap readline program which may interfere with rebel readline

practicalli-johnny 2023-04-30T14:47:32.560779Z

The reloaded workflow might do something, but I assume everything will be connected to a Clojure repl rather than a ClojureScript repl. Given that a ClojureScript repl is often launched from a Clojure REPL, then there may still be some use. Happy to help explore this aspect if you have a particular project or tooling in mind.

James Amberger 2023-04-30T20:33:29.406359Z

thank you

James Amberger 2023-04-30T20:33:59.544449Z

seems you've saved a lot of people a lot of work

James Amberger 2023-04-30T20:34:10.807149Z

cheers

James Amberger 2023-04-30T20:35:16.095569Z

a lot to explore

James Amberger 2023-04-30T21:17:57.537819Z

Hmm. clojure -M:repl/rebel-cljs complains that Could not locate rebel_readline_cljs/main__init.class, rebel_readline_cljs/main.clj or rebel_readline_cljs/main.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.

James Amberger 2023-04-30T21:19:31.688259Z

Is that because my java version is >15?

practicalli-johnny 2023-04-30T21:58:25.405079Z

I have been trying that alias out myself and am also getting the same issues. I have tried using Java 11 and adding a separate Nashorn dependency with Java 17, but haven't had any luck as yet

practicalli-johnny 2023-04-30T22:01:09.885739Z

To have a rebel readline with ClojureScript, the easiest way is to create a project with https://github.com/bhauman/figwheel-main-template

practicalli-johnny 2023-04-30T22:03:13.866709Z

Portal for ClojureScript seems to need to call a main but so does figwheel, so that's something I need to look into.

practicalli-johnny 2023-04-30T22:04:56.053319Z

The ClojureScript version of rebel needs Nashorn which is no longer in Java. Maybe Java 8 is required to make rebel readline for ClojureScript I'll take another look tomorrow