shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
2021-05-24T11:54:24.109200Z

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

thheller 2021-05-24T11:58:06.109500Z

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

2021-05-24T11:59:16.110200Z

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

thheller 2021-05-24T12:04:09.110800Z

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

1👍
hoppy 2021-05-24T15:25:28.114100Z

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?

thheller 2021-05-24T15:32:58.114900Z

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

thheller 2021-05-24T15:33:15.115200Z

manual copy works too though

thheller 2021-05-24T15:34:25.116500Z

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

thheller 2021-05-24T15:34:51.117100Z

then the only extra option you'll need is :devtools {:devtools-url "<http://your-computer-ip:9630>"} in your build config

thheller 2021-05-24T15:34:55.117300Z

thats it

hoppy 2021-05-24T15:35:32.117500Z

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

hoppy 2021-05-24T16:32:38.119700Z

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.

hoppy 2021-05-24T16:33:07.120300Z

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

hoppy 2021-05-24T16:33:28.120800Z

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

hoppy 2021-05-24T16:33:41.121100Z

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

thheller 2021-05-24T16:36:57.121400Z

eval happens whereever the process runs, so your pi

thheller 2021-05-24T16:37:34.122200Z

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

thheller 2021-05-24T16:38:06.122800Z

https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshooting maybe that helps a little

hoppy 2021-05-24T16:38:25.123100Z

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

thheller 2021-05-24T16:38:40.123600Z

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

thheller 2021-05-24T16:38:49.124Z

need to select the REPL for the build you created

hoppy 2021-05-24T16:39:00.124100Z

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

hoppy 2021-05-24T16:39:01.124300Z

hmm

hoppy 2021-05-24T16:40:17.124600Z

yes that seems the be the issue - much better

hoppy 2021-05-24T16:41:38.125Z

that is really nice - thank you!

hoppy 2021-05-24T16:56:51.126600Z

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.

thheller 2021-05-24T16:57:36.127Z

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

thheller 2021-05-24T16:57:44.127300Z

and having dependencies installed there

hoppy 2021-05-24T17:53:58.128400Z

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