Fork me on GitHub
#shadow-cljs
<
2019-02-12
>
levitanong08:02:42

hi all, what is the idiomatic way of getting all the dependencies a la lein deps? I’m running docker, and I want to be able to cache the dependencies, so I don’t have to download each time i shadow-cljs release in my CI pipeline

thheller08:02:08

shadow-cljs info will do that (assuming you have :dependencies actually in shadow-cljs.edn)

levitanong08:02:47

@thheller would shadow-cljs info still work if I used deps.edn for dependencies?

thheller08:02:46

just call clojure with some opts in that case

thheller08:02:57

clojure -Stree or something

levitanong08:02:22

Hmm. I’m already doing that, but somehow shadow-cljs release still ends up downloading the dependencies all over again.

thheller08:02:57

you probably don't have shadow-cljs itself explicitely in your deps.edn?

levitanong08:02:10

… oooh, that could be it!

thheller08:02:23

shadow-cljs automatically adds it on startup

thheller08:02:17

a "dirty" way to make shadow-cljs download the deps would be shadow-cljs clj-eval 1

thheller08:02:36

but that will start the entire process which adds a couple secs and isn't strictly necessary

levitanong08:02:10

got it 🙂 thanks, @thheller!

thheller08:02:10

I can maybe add something that works with lein and deps.edn

mauricio.szabo13:02:52

Why does, sometimes, my shadow-cljs compiles a code that have the error: ReferenceError: $cljs is not defined

mauricio.szabo13:02:22

I can't reproduce exactly what happens, but it's common when I'm developing a code in one machine and change to another

thheller15:02:32

no idea. never seen that?

thheller15:02:23

since $CLJS is only used in development builds are you maybe trying to load a development build compiled on one machine on the other? that is never supported and should not be done.

mauricio.szabo17:02:06

No, it normally occurs when I'm developing on one machine, then I pull the repository from another one and try to compile with shadow-cljs watch <build-id>. Most of the time it solves by deleting .shadow-cljs folder, target, node_modules, and trying again.

mauricio.szabo17:02:23

Once I had to upgrade shadow-cljs because nothing else solved it

lilactown18:02:07

are you committing the .shadow-cljs folder and/or the build files?

mauricio.szabo21:02:48

No, I'm not commiting any build files

thheller22:02:44

nothing should ever require deleting .shadow-cljs so I'm kinda curious what you are doing

thheller22:02:18

can you tell me more about your setup? I don't understand what $cljs is? Is that just because you typed the message by hand maybe? shadow--cljs has zero references for $cljs only $CLJS?

mauricio.szabo22:02:31

I'm using shadow-cljs with lein to develop Chlorine, and now I'm trying some integration tests in the branch full-editor-tools of my repl-tooling repo (https://github.com/mauricioszabo/repl-tooling/)

mauricio.szabo22:02:39

Today I updated my repository on another machine to keep developing the branch and it complained about missing showdown dependency from NPM (never heard of it).

mauricio.szabo22:02:57

I've instaled and fired up electron on my UI, and saw that error on console.log 🙂

mauricio.szabo22:02:04

Have no idea what happened too...

thheller22:02:20

not sure how electron is related to any of that?

thheller22:02:40

or showdown. shadow-cljs certainly doesn't require that?

mauricio.szabo22:02:31

I'm using shadow-cljs to emit a JS so I can render on electron

mauricio.szabo22:02:43

showdown, I have no idea why it asked.

mauricio.szabo22:02:22

(on my home's machine it didn't ask for showdown too)

thheller22:02:58

hahaha Latest commit dead100 5 hours ago

💀 5
🔫 5
thheller22:02:08

nice hash start 🙂

thheller22:02:01

just did a git reset to clean up some stuff I was testing and ended with HEAD is now at dead100 .... was a bit confused for a second 😉

😛 5
grav22:02:33

Hm, what to do about shadow-cljs - connection closed!? In the inspector I get `WebSocket network error: The operation couldn’t be completed. (OSStatus error -9807.) cljs$core$IFn$_invoke$arity$variadic — browser.cljs:25:97`

thheller22:02:29

the error seems to be Invalid certificate chain.

grav22:02:09

Yes - ah, maybe I did not install the cert on the client correctly. It’s iOS 12

grav22:02:27

It’s just that it doesn’t really complain about SSL, and there’s no “lock with a cross” or similar

thheller22:02:01

I just googled OSStatus error -9807 since I also have no idea what this is about. it certainly is nothing from shadow-cljs

grav22:02:05

I’ve installed the cert successfully on the Mac, and there it works in Safari

grav22:02:17

Ah, okay. I wasn’t so lucky with my googling (edit - quotes helped)

thheller22:02:11

oh did you maybe not configure the ssl in shadow-cljs but some other server isntead?

thheller22:02:47

as the websocket connection goes to the shadow-cljs server

grav22:02:03

i do use shadow-cljs for ssl - using the default config as per the guide.

thheller22:02:30

try to connect to (thats where the websocket connects to)

grav22:02:44

It seems to work just fine, both with Safari and even Chrome on an Android (although the latter still shows https://

grav22:02:22

(oh, it’s >)

thheller22:02:33

thats fine too

grav22:02:34

(since i’m testing on a device)

grav22:02:03

it says “websocket not connected”

thheller22:02:15

I mean you literally open that url in a browser on the device

grav22:02:24

same with Safari on Mac, though (where reload works)

thheller22:02:25

see what the browser has to say about that

grav22:02:38

yes, the browser displays a page with the above text

thheller22:02:25

oh right ... guess the websocket connection is failing there too

thheller22:02:19

yeah nevermind it doesn't expect ssl yet

thheller22:02:43

but the connection itself works? no warnings or so?

grav22:02:51

Looking in the inspector, it says “[blocked] The page at https://dolly.local:9630/dashboard was not allowed to run insecure content from <ws://dolly.local:9630/api/ws>. p1 — app.js:1877:84”

grav22:02:00

(my computer’s name being dolly :-)

thheller22:02:31

yeah that is the UI websocket. unrelated to a build ws

thheller22:02:43

not sure why it would fail your websocket

thheller22:02:03

it should be connecting to ...

grav22:02:56

seems to do so in Mac Safari … I’ve probably still not installed the cert correctly on the iPhone

thheller23:02:29

self signed ssl certs suck 😞

grav23:02:07

There’s a post here from jan 18 that also mentions not being able to use wss on iOS with self-signed certs, even though it works on Mac: https://stackoverflow.com/a/48155102/202538

grav23:02:02

He suggests not using SSL, but the problem is, I’m playing around with the getUserMedia api that requires it. I guess I’ll just have to live without hot-reloading on the iOS device. It still works perfectly on both Android and Mac Safari though.

reset23:02:44

Hey all, been using shadow-cljs for a few months now and finally getting productive. I ran into an issue today that I’m just not able to debug and was hoping someone here may have seen the same thing and has a resolution. I have a situation where “nested” Reagent components won’t cause a re-render in the browser if I save the file the function returning the renderer is defined in. However, if I change the calling file things get picked up just fine. Moving the nested function into the same file as the caller will also result in a success, so it doesn’t appear I’ve got the return value wrong. In both cases the shadow-cljs loader icon will pop up and in the browser as if things worked. Any ideas?

thheller23:02:52

if you keep a function reference to something from another namespace that function reference can't be updated

thheller23:02:08

(def x other-namespace/foo)

thheller23:02:26

if you update the code in the other-namespace x won't be updated (only if the namespace with x is also reloaded)

reset23:02:13

I’ll move things into a gist so it’s more clear

reset23:02:08

@thheller here’s a clearer explanation I hope. If I updated the contents of login-panel/component, let’s say change the text of “Sign In” to “Other Sign In”, things won’t reload even though the spinner appears. Apologies if this is exactly what you’re explaining and I just don’t understand quite yet 😉 https://gist.github.com/reset/cc0781ec1cf45dc20f7238a98eaf0030

lilactown23:02:19

@jamie857 are you re-rendering the application?

reset23:02:59

Added the r/render call as well to that gist just now

thheller23:02:43

I don't know much about reagent but it may just short circuit your render somewhere. just stop rendering because it thinks nothing changed

reset23:02:46

@lilactown I’m not sure, but what I am doing is modifying the function, saving the file, and not seeing the page automatically reload

thheller23:02:56

do you have the hooks configured correctly? because the gist is not correct

reset23:02:26

Which portions are incorrect? I’m lifting this out of an app and trying to form it for the gist, so I might have things wrong

reset23:02:33

And which hooks?

lilactown23:02:37

I believe you need to set :dev/after-load for your start! function

thheller23:02:45

for one you should never call (start!) like that

reset23:02:19

I’ll look into these bits

thheller23:02:52

you should also get a warning on the console if no hooks are configured

reset23:02:34

I see that now, yep. No after-load hooks are configured

thheller23:02:47

yeah then your render is simply not triggered

thheller23:02:12

(defn ^:dev/after-load start! [] ...)

reset23:02:23

Giving this a shot now

reset23:02:31

This will take me a bit to digest and try out but thank you very much for the help. I’m going to re-read the docs and see what I end up with. And thanks for shadow-cljs, even though my setup is clearly not there it’s been a pleasure to iterate with