Fork me on GitHub
#shadow-cljs
<
2022-10-10
>
Ferdinand Beyer07:10:24

I feel I am missing something. On the command line, I can start the server and a watch worker using:

shadow-cljs watch my-build
This will stay in the foreground, I can cancel with ctrl+c. I can also start a server without watchers using:
shadow-cljs start
...and then start (background) watches using the UI at . After starting the server in the background, can I also start a watcher in the background, using the CLI?

valerauko14:10:29

if you have a function in the user(.clj) ns like

(defn watch-foo
  {:shadow/requires-server true}
  []
  (shadow.cljs.devtools.api/watch :foo))
you can then run it either from the repl or with shadow-cljs run user/watch-foo

lilactown14:10:54

you can also send processes to the background using good ol' terminal commands https://linuxhandbook.com/run-process-background/

lilactown14:10:47

the shadow-cljs start command is nice because you can stop a watch without stopping the server, meaning starting other watches is fast

Ferdinand Beyer15:10:28

Exactly, this is why I'd like to start the server independent from starting/stopping watches. Since I want to integrate that with other tooling, running watch in the background is not feasible I fear. @UAEH11THP - this looks interesting, will have a look

🚀 1
lilactown15:10:30

@U922FGW59 I'm not sure what you mean "running watch in the background is not feasible I fear."

Ferdinand Beyer15:10:58

I meant:

shadow-cljs watch my-build &

lilactown15:10:12

right, why can't that work?

lilactown15:10:37

if you start the server first, your watch will connect to the server and when you stop the watch it will not stop the server

Ferdinand Beyer15:10:38

For example, if you want to run this from a babashka script

lilactown15:10:59

I don't understand what you mean by "running in the background at the CLI" then

Ferdinand Beyer15:10:32

When I start a server with shadow-cljs start, it starts in the background. I can then go to the UI and start a watch, without having to keep a terminal open for the watcher. I'd like to have the same behaviour at the CLI: To start/stop a watcher without binding the watch to my terminal

lilactown15:10:34

idk i'm clearly missing something.

lilactown16:10:33

if you're running shadow-cljs watch my-build directly from your terminal, then adding & at the end will start it in the background. if you're using babashka to run it, then you should be able to start the babashka process in the background. but i don't really understand what you mean at this point, so i'll let others try and help

valerauko16:10:05

even if you & a process if you close the terminal doesn't it get killed? when you shadow-cljs run a function that :shadow/requires-server, the server will process it and your cli command (the shadow-cljs run) will exit almost immediately

👍 1
Ferdinand Beyer16:10:11

Hm, weirdly this custom script solution does not work for me either. It compiles, but does not start a watcher?! n/m looked at the wrong place

lilactown20:10:43

is there a way for me to ignore different warnings in different ns' when compiling with warnings-as-errors?

lilactown14:10:12

The docs show how to ignore certain ns, and what warnings to ignore

lilactown14:10:20

But there’s no way to specify “in this ns, only ignore this warning. In this other ns, only ignore this other warning”

lilactown14:10:44

Unless i am misunderstanding the docs

thheller16:10:43

right, no thats not supported.

thheller16:10:51

warnings are also supposed to be fixed, not ignored 😛

lilactown18:10:11

Marking a fn as deprecated is a different level of warning than using an unbound var

lilactown18:10:43

Or a lib shadowing a new var in clojure.core