Fork me on GitHub
#shadow-cljs
<
2020-10-21
>
Schpaa09:10:16

I am experimenting with build-hooks in shadow-cljs and I wondered why this fragment wont kick in when building a release:

(defn simple-user-test {:shadow.build/stages #{:configure :flush :compile-prepare}} [state args]
  (println "HELLO:")
  (println (with-out-str (pprint args)))
  (println (:shadow.build/stage state)))
  state) 
but if I pass in a keyword, like :flush (instead of the set) it works fine…?

simongray09:10:47

I’m not really qualified to answer this, but in your example code snippet you seem to be missing the ^ marking the map as metadata?

Schpaa09:10:32

interesting, well it works fine without the set

simongray09:10:34

my bad, apparently the defn macro allows for attaching metadata using a plain map. I didn’t realise that 🙂

Schpaa09:10:03

yup, cheers

Schpaa09:10:50

This is what the docs say:

The hook is a just a normal Clojure function with some additional metadata. The {:shadow.build/stage :flush} metadata informs the compiler to call this hook for :flush only. You may instead configure {:shadow.build/stages #{:configure :flush}} if the hook should be called after multiple stages. At least one configured stage is required since the hook otherwise would never do anything.

thheller09:10:46

@schpaencoder when using a set it is stages not stage

thheller09:10:34

easy to miss 😛

neilyio16:10:07

Is there a way to get the shadow-cljs classpath from the command line? This is mentioned in https://github.com/thheller/shadow-cljs/issues/558, I'm just wondering what the best solution is to use clj-kondo, https://github.com/borkdude/clj-kondo#project-setup.

dpsutton16:10:53

shadow-cljs classpath. described in shadow-cljs --help

neilyio16:10:05

Yep just saw that... Thanks for the reply!

jmckitrick21:10:37

@thheller (or anyone else who might know) not long ago, you suggested I ignore that ‘builds’ page that pops up after a successful build.

jmckitrick21:10:01

Does that page have or will it have a useful purpose? Or is it just a relic or diagnostic tool?

thheller21:10:56

@jmckitrick not a clue what you mean. what is "‘builds’ page that pops up after a successful build"?

jmckitrick21:10:10

I assume it’s shadow-cljs, but I could be wrong. a question pops up after CIDER starts the CLJS REPL and says Visit '' in a browser? (y or n)

jmckitrick21:10:31

Some told me ‘just say no and ignore this’

thheller21:10:54

that is a cider question. it isn't coming from shadow-cljs. not a clue what controls it.

jmckitrick21:10:53

ok, sorry…

thheller22:10:16

the page it wants to open is the shadow-cljs UI

thheller22:10:33

if you don't care about it you don't need to use it

thheller22:10:07

but the prompt is not from shadow-cljs

dpsutton22:10:13

(setq cider-offer-to-open-cljs-app-in-browser nil)

thheller22:10:26

@dpsutton if that supposed to open the actual user app? then it is opening the wrong URL maybe?

thheller22:10:47

9630 is always the shadow-cljs UI, never anything the user builds

dpsutton22:10:08

correct. i believe its usally spot on. when the port is 3000 it offers that port. been a bit but i wouldn't be surprised if this is maybe when deps are managed by lein or deps perhaps

dpsutton22:10:50

i have 3000 listed as my port but that's occupied so shadow bumped up to 3001. i was correctly offered to see 3001

dpsutton22:10:55

searches the nrepl server output for (search-forward-regexp ":[0-9]+" nil 'noerror)

dpsutton22:10:09

parsing this output

shadow-cljs - HTTP server available at 
shadow-cljs - server version: 2.8.37 running at 
is it deterministic that the HTTP server output is before the shadow server output?

thheller22:10:42

not a clue actually 😛

thheller22:10:17

but the line is different so maybe just ignore the server line?

dpsutton22:10:43

yeah i should open an issue. maybe look around for all of the different versions to watch out for