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…?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.
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?
interesting, well it works fine without the set
and https://shadow-cljs.github.io/docs/UsersGuide.html#build-hooks does not involve any ^
@schpaencoder when using a set it is stages
not stage
ah!! dang
my bad, apparently the defn macro allows for attaching metadata using a plain map. I didn’t realise that 🙂
easy to miss 😛
yeah!
yup, cheers
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.
shadow-cljs classpath
. described in shadow-cljs --help
Yep just saw that... Thanks for the reply!
@thheller (or anyone else who might know) not long ago, you suggested I ignore that ‘builds’ page that pops up after a successful build.
Does that page have or will it have a useful purpose? Or is it just a relic or diagnostic tool?
@jmckitrick not a clue what you mean. what is "‘builds’ page that pops up after a successful build"?
I assume it’s shadow-cljs, but I could be wrong. a question pops up after CIDER starts the CLJS REPL and says Visit '<http://localhost:9630>' in a browser? (y or n)
Some told me ‘just say no and ignore this’
that is a cider question. it isn't coming from shadow-cljs. not a clue what controls it.
ok, sorry…
the page it wants to open is the shadow-cljs UI
if you don't care about it you don't need to use it
but the prompt is not from shadow-cljs
(setq cider-offer-to-open-cljs-app-in-browser nil)
@dpsutton if that supposed to open the actual user app? then it is opening the wrong URL maybe?
9630 is always the shadow-cljs UI, never anything the user builds
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
i have 3000 listed as my port but that's occupied so shadow bumped up to 3001. i was correctly offered to see 3001
searches the nrepl server output for (search-forward-regexp "<http://localhost>:[0-9]+" nil 'noerror)
parsing this output
shadow-cljs - HTTP server available at <http://localhost:3001>
shadow-cljs - server version: 2.8.37 running at <http://localhost:9630>
is it deterministic that the HTTP server output is before the shadow server output?not a clue actually 😛
but the line is different so maybe just ignore the server line?
yeah i should open an issue. maybe look around for all of the different versions to watch out for