This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-03
Channels
- # announcements (3)
- # babashka (29)
- # beginners (95)
- # calva (109)
- # cider (16)
- # clj-kondo (6)
- # clj-together (1)
- # cljdoc (2)
- # cljsrn (2)
- # clojure (85)
- # clojure-europe (26)
- # clojure-india (1)
- # clojure-seattle (1)
- # clojure-uk (6)
- # clojurescript (14)
- # conjure (4)
- # cursive (8)
- # datomic (6)
- # emacs (21)
- # events (1)
- # figwheel-main (5)
- # fulcro (11)
- # graalvm (32)
- # graphql (1)
- # holy-lambda (7)
- # humbleui (7)
- # jobs (3)
- # membrane (8)
- # nextjournal (31)
- # off-topic (29)
- # pathom (14)
- # polylith (9)
- # portal (16)
- # practicalli (4)
- # reitit (17)
- # releases (1)
- # remote-jobs (2)
- # ring (4)
- # sci (20)
- # shadow-cljs (24)
- # sql (1)
- # vim (12)
- # xtdb (3)
To get started, there is a https://github.com/djblue/portal#development. After https://github.com/djblue/portal#dependencies are installed, it should be as easy as bb dev
. For the most part, Portal is a web app so any experience with that should be useful. I used emacs + lsp + inf-clojure but, you should be able to hack on portal any setup.
So, I also use emacs+lsp, when I jack in I get:
error in process sentinel: Could not start nREPL server: WARNING: Specified aliases are undeclared and are not being used: [:dev-cljs]
WARNING: Use of :main-opts with -A is deprecated. Use -M instead.
Execution error (FileNotFoundException) at nrepl.cmdline/require-and-resolve (cmdline.clj:201).
Could not locate shadow/cljs/devtools/server/nrepl__init.class, shadow/cljs/devtools/server/nrepl.clj or shadow/cljs/devtools/server/nrepl.cljc on classpath.
Full report at:
/tmp/clojure-5183434269168406784.edn
I forgot the docs mention cider-jack-in . I was having issues with the .dir-locals so I stopped using it a while back. Now, I start the project with bb dev
and connect to the repl from emacs. Sorry for the confusion.
No worries. So, let's say, after starting bb dev
I open the src/portal/api.cljc
file, then I do cider-connect-clj&cljs
which finds automatically portal:37589
, then I choose shadow
as the cljs repl type, and then I'm presented with a choice of shadow-cljs builds:
:client
, :pwa
, :vs-code
, :node
, browser-repl
and node-repl
. Questions:
1. How do they differ and which one should I use?
2. How is it possible that one repl can do both clj and cljs (I'm used to developing apps in cljs only but I'm confused by the two aspects)
For example, even after choosing I think :client
, if I change the definition of portal/ui/state/select-parent
I get that there's no cljs repl available
The client is the main one you want for connecting to the UI. The problem you are probably running into is needing to open the dev version of the UI, which can be done like https://github.com/djblue/portal/blob/master/dev/user.clj#L58.
Yes, that was indeed the problem, thanks! For reference, what thought process should I have used to discover that myself?
https://github.com/djblue/portal/blob/master/dev/portal/setup.cljs#L63-L64 might also be interesting for debugging the client state
I was looking into using dev/portal/setup.cljs
. If I open that file, cider-connect-clj&cljs
to the nrepl server opened by bb dev
, I still get No available JS runtime.
How should I invoke, eg, (def portal (p/open {:mode :dev :value state/state}))
. Why does this happen?
You first need to do (portal.api/open {:mode :dev})
from the jvm which will open the Portal UI (a JS runtime) then your shadow repl should have an environment to evaluate cljs, and then you can run (def portal (portal.web/open {:mode :dev :value state/state}))
and other expressions to poke around the client runtime=
Right, I tried that before, but I get :repl/exception
, and then in my repl:
Execution error (TypeError) at (<cljs repl>:1).
Cannot set properties of null (setting 'onunload')
Although I have a feeling that https://github.com/djblue/portal/commit/740ff1d317bbe8fc86deedf1a329e5652adaa090 might be of interest to you 🎉