Fork me on GitHub
#shadow-cljs
<
2019-01-11
>
hueyp02:01:24

or basically — how to not get warnings on every reload for library code

hueyp02:01:27

that I can’t change~

thheller10:01:39

@U0KHZ4HNG it is only supposed to warn once for library code?

thheller10:01:43

the :from-jar is supposed to filter everything where the source file is in a jar, ie. library

thheller11:01:08

which library is causing warnings?

hueyp23:01:31

hmm, good point … our build system is a bit bespoke (we use BUCK) so at times our jars aren’t jars … but in this case I think they are in fact jars. its stuff like om.next warning about *logger*, etc. we also execute everything from the devtools api, not the command line, if that matters, e.g. (server/start!), (shadow/watch :foo)

hueyp23:01:55

I’m very much on board with the warnings in our namespaces — they’ve found actual bad stuff so far 😜

hueyp23:01:54

I’ll try and dig in and see the root cause of why :from-jar isn’t hitting our case

tony.kay02:01:00

I just built a custom target type for nubank workspaces for shadow to auto-scan…was pretty easy. Thanks @thheller for making hooks to make that possible!

🎉 15
mitchelkuijpers14:01:31

Damn that is way simpler than I would have expected

tony.kay19:01:29

Yeah, right?

thheller10:01:45

@tony.kay what kind of auto-scan? I have some built-in workspaces support but didn't quite figure out how to configure things like preloads and other dev stuff. would be interested to see what you built

thosmos15:01:16

Is there a way to get Cursive to resolve npm requires? I'm having an issue where doing something like (ns my.ns (:require ["firebase/auth" :as fb-auth])) is showing up marked as unresolved. If not, is there a way to trick it?

thheller15:01:34

@thosmos unfortunately not. I don't think string requires are undestood at all at this point. let alone npm resolve.

thosmos15:01:21

Is there a way I could pre-package it somehow so that I could do (:require [firebase]) and have cursive resolve it. Maybe with externs? I guess this is what cljsjs does?

thheller15:01:03

cljsjs doesn't really set any namespace aliases so there isn't much to resolve

thheller15:01:21

you only (:require [cljsjs.react]) without alias and use the global js/React

thheller15:01:31

the problem only appears when you try to alias it

thosmos15:01:46

So if I wanted it to resolve all the fns I'd need to create stubs for each namespace including each fn signature? Would that theoretically work? I imagine that an externs file could be used to auto-generate this.

thheller15:01:27

no idea how you'd solve this. I just turned the warning off in Cursive

thheller15:01:11

don't know enough about how cursive deals with any of this

thosmos15:01:12

ok thanks. I still much appreciate being able to code directly against the required symbol rather than js/whatever

thheller15:01:19

should probably open an issue and ask

thosmos15:01:39

I know that it sometimes asks to generate stubs for some deps, but I have no idea what that means

thheller15:01:53

yeah me neither

wilkerlucio15:01:16

@thheller @tony.kay just tried using the new target, I have an issue because my old main had some requires that were used by all the other things, but none of then require it (specs file and workspace extension things), is there a way to indicate that those should be loaded before anything else? I tried just adding a new file that requires those, but the topological order is getting wrong and the code is trying to use the specs before they are loaded

wilkerlucio15:01:29

I know I could just require it everywhere, but the point is trying to avoid it

thheller15:01:15

could probably change the target to allow you to specify these in config

thheller15:01:34

similar to :devtools {:preloads [some.ns]}

wilkerlucio15:01:22

can I just add those to :entries?

thheller15:01:26

you can but the target doesn't use that so you need to adjust the target code to use it

thheller15:01:28

(assoc-in [::modules/config :main :entries]
  (-> '[]
      (into (get config :entries []))
      (into dynamically-resolved-namespaces)
      (conj 'nubank.workspaces.shadow-cljs.mount))))

👍 5
thosmos15:01:50

Are you aware of any IDE that provides editor introspection based on js externs, even if it's only available in javascript? This might be easy to leverage for CLJS.

thheller15:01:46

I don't know anything that provides accurate introspection based on npm packages

thheller15:01:01

for JS source maybe but not the garbled prebuilt mess thats sometimes on npm

wilkerlucio16:01:29

@thheller that worked great 🙂

wilkerlucio16:01:15

sometimes in my CI the tests are failing with ../deploy/bin/shadow-karma-test: line 9: echo: write error: Resource temporarily unavailable, had anybody here had this problem? ideas what could be about?

wilkerlucio16:01:21

it only fails sometimes, I would say about 30% of the runs

thheller17:01:58

hmm no idea

wilkerlucio17:01:29

I wonder if some IO resource is taking too long to respond and causing it

thheller17:01:12

what is it doing in that script?

thheller17:01:23

doesn't look like any java error

clj-dave22:01:20

Hi there! Is there anyway to pass data to shadow-cljs through the command line that can be accessed in the shadow-cljs edn file?

clj-dave22:01:42

I'd like to read environment variables and pass them to my build via goog defines