Fork me on GitHub
Eccentric J03:01:54

If I want to create an npm module users can install as a CLI and just use, which shadow-cljs build target should I use?


probably :node-script

Eccentric J05:01:01

Thanks, I did read that URL first but was unclear to me.


@jayzawrotny or :npm-module depending on your needs. :node-script is simpler and probably what you want.


What's the best way to read an EDN file in ClojureScript given that slurp is unavailable?


I realized I was being silly here because I was trying to hide a public key from the repo thinking it was a secret key. I'm still curious though should the need arise what to do here.

Eccentric J06:01:44

fs/readFileSync + read-string?


If it is amenable to compile time, you could do it with a macro. (Avoid doing that in a library, because it is incompatible with :aot-cache, but it should be OK in application code.)


Good Day everyone. Just recently the latest version of Nonforum was released. It's built on ClojureScript with Rum, Sente, and Accountant, and a little bit of Clojure to have a server. Check it out! it's a fresh start so all the cool aliases are still available.

Eccentric J16:01:57

I use that project.clj below then run lein repl and I get a fatal error:

Exception in thread "main" java.lang.ExceptionInInitializerError
        at clojure.main.<clinit>(
Caused by: Syntax error compiling at (org/httpkit/server.clj:1:1).
        at clojure.lang.Compiler.load(
        at clojure.lang.RT.loadResourceScript(
        at clojure.lang.RT.loadResourceScript(
        at clojure.lang.RT.load(
        at clojure.lang.RT.load(
        at clojure.core$load$fn__6824.invoke(core.clj:6126)
        at clojure.core$load.invokeStatic(core.clj:6125)
        at clojure.core$load.doInvoke(core.clj:6109)
        at clojure.lang.RestFn.invoke(
        at clojure.core$load_one.invokeStatic(core.clj:5908)
        at clojure.core$load_one.invoke(core.clj:5903)
        at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)
        at clojure.core$load_lib.invokeStatic(core.clj:5947)
        at clojure.core$load_lib.doInvoke(core.clj:5928)
        at clojure.lang.RestFn.applyTo(
        at clojure.core$apply.invokeStatic(core.clj:667)
        at clojure.core$load_libs.invokeStatic(core.clj:5985)
        at clojure.core$load_libs.doInvoke(core.clj:5969)
        at clojure.lang.RestFn.applyTo(
        at clojure.core$apply.invokeStatic(core.clj:667)
        at clojure.core$require.invokeStatic(core.clj:6007)
        at clojure.core$require.doInvoke(core.clj:6007)
        at clojure.lang.RestFn.invoke(
        at figwheel_sidecar.components.figwheel_server$eval18541$loading__6706__auto____18542.invoke(figwheel_server.clj:1)
        at figwheel_sidecar.components.figwheel_server$eval18541.invokeStatic(figwheel_server.clj:1)
        at figwheel_sidecar.components.figwheel_server$eval18541.invoke(figwheel_server.clj:1)
any insight as to why it’s combusting?


I can't say why it's not working, but I can recommend using shadow-cljs since you are using npm packages

Eccentric J16:01:00

I’m working on a lein-template that provides both a figwheel and a shadow-cljs variation so unfortunately I gotta do the leg work and learn it.


Here you can find full example how to use figwheel-main + cljs + npm dependencies


Oh and everything besides of solution with shadow-cljs and figwheel-main suc** IMO 🙂


Only this 2 matter IMO

👍 1

@jayzawrotny you've got some fundamental incompatibilities in your project.clj due to a migration from tools.nrepl -> nrepl/nrepl. Some things that stick out: i think your figwheel sidecar is very outdated. I think its up to 0.5.17 now? com.cemerick/piggieback 0.2.2 should be cider/piggieback 0.3.10 (possibly 11?) and the nrepl middleware to wrap cljs repl should use cider.piggieback/wrap-cljs-repl. Also, since you are specifying 2.8.3 for lein, any dependency that uses tools.nrepl will likely poison your setup

Eccentric J16:01:51

Thanks, this is the thorough ass kicking I needed! What should I be specifying for lein, 2.0.0?


latest is 2.8.3


it's kinda annoying right now because some low level stuff has been migrated out of core-contrib and there's a bit of churn right now


and chas stepped away from clojure so nrepl and cider orgs inherited the piggieback and nrepl repos

Eccentric J17:01:53

I remember some of the discussion around that. It’s unfortunate.

Eccentric J17:01:11

Great, it’s working now thanks!


the docstring for sort-by in clojure includes "guaranteed to be stable" and this is absent from clojurescript. I suppose this is intentionally absent and I should not rely on this property? *clojurescript-version* => "1.9.946"


i suppose this is telling: ;; matching Clojure's stable sort, though docs don't promise it


Is there an equivalent to for CLJS?


I’m having an issue where nothing in my externs file is being reflected in my advanced compilation build. Is there a place to start to try to debug that? Adding an obviously non-existent file to my :externs vector in the compiler options doesn’t generate a warning, for example.


are you using lein/cljsbuild?


One quick thing to check is add :verbose to see if your compiler options are being used at all (


Cool, trying that


Yeah, looks like the compiler options are being picked up, and my externs file is included in that vector.


@joshmiller did you hand write the externs?


it's pretty common for people to not write these properly


Google Closure accepts a very strict syntax


Ok, I’ll look into that. These are hand-written for a first-party JS dependency, so I might have screwed that up.


@joshmiller are you aware that we can generate externs automatically for you now?


currently it does mean the file needs to be part of the build as a foreign library


however that will change probably after the next release


Vaguely, so I can give that a shot as well.


one common misconception about externs is that you can write stuff like


var api = {"foo" ...};


doesn't work


no object literals


no strings

Eccentric J20:01:20

If you’re writing a cljs cli what is the recommended approach for cli arg parsing?

Eccentric J20:01:41

Using the clojure cli tools lib or an npm module like yargs?


the api for a ClojureScript one will probably be more idiomatic

Eccentric J20:01:52

Oh right, the npm one would return a js array\object not a clj vec\map. Thanks!


I think that's a loop/recur problem. Not direct related to core.async


One-line reproduce.

clj -Srepro -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.0"} org.clojure/clojurescript {:mvn/version "1.10.439"}}}' -m cljs.main --repl-env node -e '(defmacro myloop [bindings & body] `(loop ~bindings [email protected])) (myloop [] (recur))'


Bump. There is a issue about that?


consider posting this in #cljs-dev