This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-30
Channels
- # asami (4)
- # babashka (3)
- # beginners (21)
- # biff (22)
- # cljs-dev (6)
- # clojure (11)
- # clojure-europe (3)
- # clojure-norway (35)
- # clojure-spain (4)
- # clojurescript (14)
- # datalevin (2)
- # emacs (12)
- # exercism (2)
- # fulcro (10)
- # honeysql (4)
- # humbleui (3)
- # hyperfiddle (49)
- # instaparse (1)
- # introduce-yourself (1)
- # missionary (1)
- # off-topic (109)
- # pathom (2)
- # practicalli (21)
- # random (2)
- # rdf (2)
- # releases (2)
- # scittle (3)
- # specter (2)
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
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")
but what if I want to load portal and rebel-readline too, all from the cli invocation
Hmm maybe I figured it out?
clj -M:repl/cljs:repl/reloaded
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 readlineThe 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.
thank you
seems you've saved a lot of people a lot of work
:cheers:
a lot to explore
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
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"]}
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.
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
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.
Is that because my java version is >15?
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
To have a rebel readline with ClojureScript, the easiest way is to create a project with https://github.com/bhauman/figwheel-main-template
Portal for ClojureScript seems to need to call a main but so does figwheel, so that's something I need to look into.
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