This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-25
Channels
- # asami (5)
- # babashka (38)
- # beginners (116)
- # calva (65)
- # chlorine-clover (4)
- # cider (8)
- # cljfx (6)
- # cljsrn (7)
- # clojure (18)
- # clojure-australia (1)
- # clojure-europe (49)
- # clojure-spec (6)
- # clojure-uk (4)
- # clojurescript (3)
- # clojureverse-ops (13)
- # core-async (2)
- # cryogen (1)
- # cursive (9)
- # datahike (32)
- # fulcro (3)
- # gratitude (17)
- # malli (4)
- # music (3)
- # nrepl (8)
- # off-topic (14)
- # releases (2)
- # rewrite-clj (3)
- # shadow-cljs (4)
- # vrac (1)
- # xtdb (4)
Hi, I was wondering if it is possible to take a jvm clojure based set of files and move them to be based on babashka? Is there a path to do this?
I have a lein project, with several files, it is a cli based application so would do really well to migrate to babashka. Is there a way to do this. I tried to use native-image from graalvm and I ended up with messages that just did not mean anything? I am using the following libraries: io.forward/yaml babashka/fs tools.cli com.wallbrew/clj-xml
I am presuming that I will have to change it to a deps.edn based file - I am expecting to swap out the yaml library as I think babashka uses a different one.
if you want to try that, you need to make a bb.edn
with:
{:deps {com.wallbrew/clj-xml {:mvn/version "1.6.2"}}}
That is a very minor part of the project - I would be happy to have a simple script to convert from xml to yaml anyway
I am presuming that I could use something like vscode to edit and run the code? if so is there a place that explains how to develop bb scripts in an IDE?
@mmer There are docs around that here: https://github.com/exercism/babashka/blob/main/docs/editors.md But just executing the script from the command line while editing is fine too, if that's too steep of a learning curve for now :)
Babashka support nREPL so you can basically connect to that from any editor which understands it
Personally, but that's just me, I hardly use this feature and test script just by running them, since it's already fast enough. But lots of people do use the REPL stuff
Hmm @pez, perhaps it would be nice to add a little section to the Calva docs how to develop a bb script, similar to this https://github.com/exercism/babashka/blob/main/docs/editors.md
@ericdallo When does Calva/LSP recognize a bb script? Is this when it sees a bb.edn?
Actually some clojure-lsp features are already available if the file is a .clj one, but for fully support, it needs a bb.edn on the project root
@mmer https://book.babashka.org/#_nrepl That's actually the section you should read.
I modernized the way of firing up an nREPL server a bit here. Make a bb.edn
:
{:tasks
{:requires ([babashka.fs :as fs]
[babashka.process :as p :refer [process]]
[babashka.wait :as wait])
nrepl (let [port (with-open [sock (java.net.ServerSocket. 0)] (.getLocalPort sock))
proc (process (str "bb nrepl-server " port) {:inherit true})]
(wait/wait-for-port "localhost" port)
(spit ".nrepl-port" port)
(fs/delete-on-exit ".nrepl-port")
(deref proc))}}