This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-16
Channels
- # babashka (17)
- # calva (35)
- # clerk (31)
- # cljs-dev (3)
- # clojars (1)
- # clojure (16)
- # clojure-europe (4)
- # clojurescript (38)
- # clojutre (2)
- # cursive (8)
- # datomic (16)
- # exercism (5)
- # fulcro (5)
- # gratitude (3)
- # hyperfiddle (55)
- # joyride (1)
- # lsp (40)
- # off-topic (6)
- # portal (64)
- # practicalli (1)
- # reitit (3)
- # releases (1)
- # shadow-cljs (38)
- # sql (1)
- # tools-deps (8)
- # xtdb (9)
Dear Calva-friends, an extra exciting release today: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.352
• https://github.com/BetterThanTomorrow/calva/issues/2152
• https://github.com/BetterThanTomorrow/calva/issues/2157
Where the exciting part is the custom Jack-in command lines. From https://calva.io/connect-sequences/#custom-command-line:
> Custom command lines are there to bridge the gap to those situations where standard Jack-in command lines don’t reach. Like:
> 1. You want to provide command line options to a supported tool, which Jack-in does not provide
> 2. Your project has some script through which it is started
> 3. The REPL is provided by some tool that Calva does not know of
> 4. Any other reason...
> A custom command line is executed from same directory as the REPL project root (See projectRootPath
, above), and can be as simple as my-repl-jack-in-command
. You can use a relative or absolute path to your command line.
@pez I'm experimenting with "autoSelectForJackIn": true
and noticed that if you provide an alias that include :main-opts
Calva does not omit -m nrepl.cmdline ...
which it does if you select the exact same aliases for a manual jack-in.
(it happens to work in my situation but it's still "wrong") Here are the two jack-in command-lines, the first with auto true, the second with auto false and the same selections
pushd /var/www/worldsingles ; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' -M:build:dev:+default:test:vscode-calva-jack-in -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" ; popd
pushd /var/www/worldsingles ; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' -M:+default:build:dev:test:vscode-calva-jack-in ; popd
:vscode-calva-jack-in
{:extra-deps {com.datomic/dev.datafy {:git/sha "4a9dffb"
:git/tag "v0.1"
:git/url ""}
djblue/portal {:mvn/version "RELEASE"}
io.github.seancorfield/dot-clojure
{:git/tag "v1.0.1"
:git/sha "e932f96"}
io.github.stuarthalloway/reflector
{:git/sha "93a0c19b4526c1180959e940202928d35e5c3cef"}
jedi-time/jedi-time {:mvn/version "RELEASE"}
party.donut/dbxray {:mvn/version "RELEASE"}}
:main-opts ["-e" "((requiring-resolve 'org.corfield.dev.repl/start-repl))"]}
"calva.replConnectSequences": [
{
"name": "World Singles Backend (Jack-In)",
"projectType": "deps.edn",
"autoSelectForJackIn": false,
"projectRootPath": ["/var/www/worldsingles"],
"menuSelections": {
"cljAliases": ["build", "dev", "+default", "test", "vscode-calva-jack-in"]
}
}
],
(toggle that to true
to see the difference in the command)
Or it is something in the "copy" logic as opposed to the execute logic that causes this and the actual command-line executed is right?
No, it still uses the "wrong" jack-in command:
; Starting Jack-in Terminal: pushd /var/www/worldsingles ; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' -M:build:dev:+default:test:vscode-calva-jack-in -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" ; popd
The projectRootPath
is "An array of path segments" -- but it can be just a single absolute path (see above). When might it need to actually be multiple sequences?
Gotcha!
Calva has afterCLJReplJackInCode
to execute Clojure code in the newly-connected REPL, but it doesn't have anything to auto-trigger one or more Calva commands after a successful jack-in. I know I could probably rig up some Joyride code to jack-in and then run other stuff but this seems like a good opportunity for more automation within Calva...?
On a related note, I see there's autoConnectRepl
to automatically reconnect to an external running REPL on start/reload -- what would be the pros of autoJackInRepl: true
to automatically jack-in on start/reload if there wasn't already a REPL to connect to?
In particular, after a successful jack-in or reconnect, I want to run the custom repl snippets that set up my Portal windows.
I've been updating all my projects with auto-jack-in and auto-connect REPL sequences this morning -- including my work setup. Makes life much simpler!
Hi calva!! I've just joined...new to the world of Clojure/Script. I have some newbie questions. Hope you don't mind. First off, thanks for Calva! I've been through the Clojure getting started tutorial. Works great! Now I'm off to ClojureScript using the "Fire up the ClojureScript quickstart REPL" tutorial. All works fine until I reload the browser page... from the tutorial:
;; Evalute these steps with Ctrl+Alt+Enter after each line.
(-> js/document
(.getElementById "app")
(.-innerHTML)
(set! "Hello ClojureScript REPL from Calva!")
;; reload browser page to restore the original content 😎
)
After a browser reload, anything I execute using Atl-Enter gives me:
cljs꞉hello-world.core꞉>
; Execution error (TypeError) at (<cljs repl>:1).
; undefined is not an object (evaluating 'cljs.pprint.pprint')
;
I'm using MacOS and Safari and Chrome ... if that matters.
The terminal output from calva looks like this:
⚡️ Starting the REPL ⚡️ using the below command line:
pushd /var/folders/6b/622j_t9n3sx1znjntr0tr19r0000gn/T/betterthantomorrow.calva/clwnsm ; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"},cider/piggieback {:mvn/version,"0.5.3"}}}' -M -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware cider.piggieback/wrap-cljs-repl]" ; popd
nREPL server started on port 63425 on host localhost -
thanksHello and welcome! It could be that you need to load/evaluate the namespace/file, or at least the (ns …)
form after having restarted the app.
Thanks much! I'm not aware that I restarted the app. I just did a refresh of the web page.
I haven't changed anything. I'm just using the file and connection as setup that results from cmd-shift-P and choosing "Fire up the ClojureScript quick start browser REPL".
I’m sorry, should have been less cryptic. With “the app” I meant the app running in the browser. The one you are hacking on with that example script. When you reload the browser, the app running there gets restarted.
I just tried the thing myself and run into the same problem as you. I don’t understand what is going on. Something goes wrong when the results are being sent back to Calva… For continuing exploring ClojureScript, maybe you can try this example project? https://github.com/PEZ/shadow-bare-bones
Noticed the dependency loaded with "Fire up the ClojureScript quick start browser REPL" uses an older version of ClojureScript 1.10.x. Should this be updated?
I just tried to update that dependency. Then some other things stop working… Pretty crazy, it is the most minimal setup ever….
Does the shadow-bare-bones template come equiped with methods for a deploy build? I'm trying out all the things I need for dev lifecycle.
I probably should config and instructions for a release build. It’s pretty straight-forward. You could try npx shadow-cljs release :app
and see what happens. The shadow-cljs user guide is here: https://shadow-cljs.github.io/docs/UsersGuide.html And shadow comes with stellar support in the #C6N245JGG channel.
If you want to try building a mobile app with ClojureScript, you can check this example project out: https://github.com/PEZ/rn-rf-shadow