This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-31
Channels
- # announcements (4)
- # babashka (73)
- # beginners (128)
- # bristol-clojurians (1)
- # calva (8)
- # cider (8)
- # clj-kondo (4)
- # clojars (7)
- # clojure (148)
- # clojure-dev (16)
- # clojure-europe (5)
- # clojure-gamedev (1)
- # clojure-italy (10)
- # clojure-nl (7)
- # clojure-uk (57)
- # clojurescript (57)
- # clojutre (1)
- # community-development (2)
- # cursive (7)
- # data-science (1)
- # datascript (5)
- # datomic (9)
- # events (6)
- # figwheel-main (1)
- # fulcro (91)
- # garden (11)
- # graalvm (14)
- # graphql (1)
- # immutant (4)
- # jobs (1)
- # kaocha (33)
- # off-topic (63)
- # onyx (3)
- # pathom (4)
- # re-frame (23)
- # ring-swagger (1)
- # shadow-cljs (49)
- # sql (6)
- # testing (8)
- # tools-deps (45)
- # vrac (1)
- # xtdb (10)
My Github sponsors profile finally went live. If you're using babashka and/or sci and want to show your support, here's a way. Even if only for 1 dollar a month, it helps sustain these projects. https://github.com/sponsors/borkdude
That's right, now I will become rich! Of course babashka / sci remains free and I will love you just as much even if you don't become a sponsor ❤️
FYI, another place where one can use Sci https://observablehq.com/@jeroenvandijk/untitled/5
I've modified an older example using a forked version of Mori.js
I have done it before with self-hosted Clojurescript which was hacky to get working. I think the interop features of Sci could make this quite interesting. Hopefully someone picks it up:)
They proxy npm somehow
i think so
You can probably also specify versions. I played with it a longer time ago and don't remember. I was lucky enough to get my old example working with Sci in a few minutes 😎
I think so too!
And what's cooler than self-hosted clojurescript is that
cljs `(fn [a b] (+ a b))`
Returns an actual javascript function that can be used with arbitrary JS results. I hope to think of a usecase soon 🙂i have a question about the usage with deps.edn. how can I pass on additional arguments? The following works in Clojure for JVM
clj -A:main -e some-option some-action
I've tried various positions of -e some-option some-action
at
deps.exe -A:main -Scommand "bb -cp {{classpath}} {{main-opts}}"
but, I can't get it to workdeps.exe -A:main -Scommand "bb -cp {{classpath}} {{main-opts}}" -- -e some-option some-action
❯ deps.exe -A:main -e foo bar
(-e foo bar)
= correct
❯ deps.exe -A:main -Scommand "bb -cp {{classpath}} {{main-opts}}" -e foo bar
clojure.lang.ExceptionInfo: Could not resolve symbol: foo [at line 1, column 1]
❯ deps.exe -A:main -Scommand "bb -cp {{classpath}} {{main-opts}}" -- -e foo bar
(-- -e foo bar)
yeah, in that case -e
is passed to babashka and babashka interprets -e foo
as "execute the expression foo` which is why you see that message
@stijn Just made that issue yesterday: https://github.com/borkdude/babashka/issues/250
so you're dealing with two levels of argument parsing here, one for deps.clj and one for babashka itself
No worries, I can run with clj main for now. Really nice how you designed the usage of babashka with deps.edn, so you can easily switch between REPL on clojure JVM, main on JVM and babashka for running the shell scripts
it shouldn't. it does run through the script for analysis, but it doesn't actually execute any functions
❯ deps.exe -M:main -Scommand "bb -cp {{classpath}} {{main-opts}} --uberscript my-script.clj"
nil
but if I put my real code in, it doesn't, since there are (System/exit 1)
statements in there because the command line args don't match what the actual script wants
❯ deps.exe -A:main -Scommand "bb -cp {{classpath}} {{main-opts}} --uberscript my-script.clj" this is a test
(this is a test)
with
(defn -main [& args]
(println args))
ah... hmm, I see! I have an option in sci (the interpreter) called :dry-run
which is what babashka uses to analyze all the code instead of executing it and then emits all the code that was loaded to the uberscript. but I only check the :dry-run
option in a function call, not when doing interop...
https://github.com/borkdude/sci/blob/398d15b8d940dd53fac17a263bbba35318ef5a0e/src/sci/impl/interpreter.cljc#L474
so a workaround for now might be to wrap System/exit
in a function and that should do the trick
ah I see:
(cond
(ifn? f) (fn-call ctx f (rest expr))
(:dry-run ctx) nil
:else
(throw (new #?(:clj Exception :cljs js/Error)
(str "Cannot call " (pr-str f) " as a function."))))
@stijn I pushed a fix to master. Shortly there will be a link for a new linux binary in #babashka_circleci_builds
@stijn this should be it: https://3916-201467090-gh.circle-artifacts.com/0/release/babashka-0.0.68-SNAPSHOT-linux-amd64.zip
confirmed that the --
works as well
deps.exe -A:main -Scommand "bb -cp {{classpath}} {{main-opts}} -- $@"
thanks @borkdudehmm @deleted-user weren't you also having issues with the uberscript? might be the same as the above?
https://3926-201467090-gh.circle-artifacts.com/0/release/babashka-0.0.68-SNAPSHOT-macos-amd64.zip
it just has two bugfixes and one new thing, I'll append it to the previous announcement
@deleted-user I noticed you were using spartan.test, if you haven't read it yet, clojure.test is now built in