shadow-cljs

isak 2025-02-10T21:40:55.506349Z

It looks like this (powershell) doesn't work (the host is not respected):

yarn shadow-cljs --config-merge "{:http {:host `"foo`"}}" run dev/setup
Where dev.clj is a file with a setup function that has {:shadow/requires-server true}. Should it?

isak 2025-02-11T16:08:04.072869Z

> Looks like I should turn off requires-server, then start it manually with a patched config? I tried that, but now I get this error:

NullPointerException: Cannot invoke "java.util.concurrent.Future.get()" because "fut" is null
        clojure.core/deref-future (core.clj:2317)
        clojure.core/deref (core.clj:2337)
        clojure.core/deref (core.clj:2323)
        shadow.cljs.devtools.server.supervisor/active-builds (supervisor.clj:14)
        shadow.cljs.devtools.server.supervisor/active-builds (supervisor.clj:12)
        shadow.cljs.devtools.api/worker-running? (api.clj:124)
        shadow.cljs.devtools.api/worker-running? (api.clj:120)
        shadow.cljs.devtools.api/watch (api.clj:206)
        shadow.cljs.devtools.api/watch (api.clj:200)
        shadow.cljs.devtools.api/watch (api.clj:204)
        shadow.cljs.devtools.api/watch (api.clj:200)
        dev/setup/body-fn--16595--auto----7247 (dev.clj:71)
        dev/setup (dev.clj:68)
        dev/setup (dev.clj:52)
        clojure.lang.Var.applyTo (Var.java:705)
        clojure.core/apply (core.clj:667)
        clojure.core/apply (core.clj:662)

isak 2025-02-11T16:27:35.698969Z

Never mind, worked around it

thheller 2025-02-11T17:21:01.188459Z

you should maybe consider using clj -X dev/setup or whichever flag that was

thheller 2025-02-11T17:21:31.855789Z

and in setup call (server/start!) with server being shadow.cljs.devtools.server

isak 2025-02-11T17:28:38.497679Z

Ah using clj is better? I guess I would need to switch this project to deps (I just have the shadow-cljs.edn currently). shadow.cljs.devtools.server/start! - that is the one I was trying, but then it said :already-running or something, and the call to watch broke. Also tried it with and without the with-runtime wrapper.

thheller 2025-02-11T17:32:40.590339Z

well watch requires a running server, {:shadow/requires-server true} starts that. if you otherwise use run the expectation is that you didn't need a server and just wanted a release build or so. so only a partial runtime is started. kinda not intended to call start with run

isak 2025-02-11T17:37:57.502759Z

Ah, I see. Well I ended up with just using #shadow/env to specify the host, that seems to work well.

thheller 2025-02-10T21:43:38.846759Z

--config-merge ONLY merges stuff into the build config. it cannot take config that is not build specific. so here it isn't even applied anywhere

isak 2025-02-10T21:44:20.325459Z

Ah, I see

isak 2025-02-10T21:44:41.306329Z

Looks like I should turn off requires-server, then start it manually with a patched config?

thheller 2025-02-10T21:46:04.579369Z

dunno what you are trying to achieve here?

thheller 2025-02-10T21:46:15.874419Z

why set the host in the first place?

isak 2025-02-10T21:46:43.521949Z

I'm testing a new thing where it needs to be dynamic for each developer

thheller 2025-02-10T21:46:55.137579Z

I'm also fairly certain that powershell quoting looks much different from what you have? it sort of gets crazy with EDN

isak 2025-02-10T21:48:27.653849Z

It looked right via echo, but I didn't get far enough to confirm, and I guess it doesn't matter if that setting can't be set via config-merge