Fork me on GitHub
#shadow-cljs
<
2021-05-24
>
Roman Liutikov11:05:24

Does shadow infer externs for JS libraries required from a file system? Seems like methods got renamed, but there’s no warnings about failed externs inference

thheller11:05:06

there is no inference for JS files, since that is only part of the CLJS compiler which they don't go through

Roman Liutikov11:05:16

makes sense, is there anything shadow/closure can do to warn about renamed symbols in JS files?

thheller12:05:09

shadow-cljs check the-build but that is very noisy

👍 3
hoppy15:05:28

hello. Does the possibility exist to create a working setup whereby node would be running on something like say a raspi-zero that can run node, connected to a regular development system that can reasonably run JVM/Shadow/node, and be able to create a repl experience, or is that folly?

thheller15:05:58

that is trivial if you use something like sshfs or so. something that makes the files from your PC available over on the pi

thheller15:05:15

manual copy works too though

thheller15:05:25

lets say :node-script you have :output-to "out/script.js" and :output-dir "out". you somehow make the out directory available on the pi and run it there via node script.js or so

thheller15:05:51

then the only extra option you'll need is :devtools {:devtools-url ""} in your build config

hoppy15:05:32

ok, let me see how far I get with that.

hoppy16:05:38

seems like this is pretty close to working. Had to stuff a 'ws' on the target device. So I'm running 'watch app' on the dev box, and running app with node on the target. It clearly gets a code reload whenever the watch decides to recompile.

hoppy16:05:07

I'm connected via calva, I guess to the watch on the dev box.

hoppy16:05:28

all of the 'evals' seem to be happening on the dev box though - is this expected?

hoppy16:05:41

gets rather opaque who I'm talking to...

thheller16:05:57

eval happens whereever the process runs, so your pi

thheller16:05:34

calva just talks to your dev box and the shadow-cljs process handles the messaging between the processes

hoppy16:05:25

I tried to validate that with a fs.writeFileSync, and I don't seem to see that behavior

thheller16:05:40

how did you start the REPL though? if you juse use node-repl that will run on the dev box

thheller16:05:49

need to select the REPL for the build you created

hoppy16:05:00

(I'm writing off in the non-shared filesystem)

hoppy16:05:17

yes that seems the be the issue - much better

hoppy16:05:38

that is really nice - thank you!

hoppy16:05:51

about the only thing I would note is that on the target, there is an implied js dependency on 'ws', which isn't there. Actually I lied, it isn't an rpi, it's a custom board which doesn't have npm, but does have node.

thheller16:05:36

best way to handle this is having a package.json in your out directory

thheller16:05:44

and having dependencies installed there

hoppy17:05:58

at least until you have a native module. But anyway, thanks for the pointers, this works fantastic.