Fork me on GitHub
#nbb
<
2022-07-24
>
lilactown02:07:21

ok, I had an itch and I think I've scratched it: a proof of concept of having a "self contained" nbb script with node_modules https://gist.github.com/lilactown/b0cb983158dcf453f2ac058d23fbe44f

borkdude07:07:14

Next step will be to add some caching. E.g. you could write the hash into node_modules after install and check next time to skip npm install

💯 1
lilactown14:07:00

I did end up just going with devDependencies for the final script 😛

😅 1
lilactown02:07:23

you can invoke ./script.cljs and it will automatically install any dependencies necessary to run it. you can also specify the env var SKIP_INSTALL=true ./script.cljs to avoid running npm install

genRaiy07:07:45

Will this work for Lambda?

valtteri08:07:16

It could work (with some tweaks at least) but you don’t probably want to run npm install on each lambda cold-start.

borkdude08:07:54

Agreed. I think the above is a hack when you don't want to acknowledge that your project just needs a package.json with some (dev) deps in it (but a cool hack nonetheless)

lilactown20:07:09

where's a good place to report library incompatibilities?

lilactown20:07:39

trying to load my library https://github.com/lilactown/cascade/ results in an error

lilactown20:07:54

Welcome to nbb v0.6.129!
user=> (require '[cascade.core])
"#error {:message \"Could not resolve symbol: object\", :data {:type :sci/error, :line nil, :column nil, :file \"/Users/lilactown/.nbb/_deps/716b236931c25c4538fd4b1d97caa046376f4e51/nbb-deps/cascade/core.cljc\", :phase \"analysis\"}}"

lilactown21:07:53

actually boiled it down to a more general issue with extending protocols https://github.com/babashka/nbb/issues/242

borkdude22:07:09

Thanks. This needs to be fixed in SCI

lilactown02:07:57

I've found another problem with protocols in nbb that needs to be fixed in SCI

borkdude15:07:27

Heads up: I'll look into your PRs on Wednesday or Thursday

lilactown15:07:56

sounds good! thanks for the communication. I'm still hacking a bit

borkdude15:07:01

I didn't look closely enough yet, but instead of introducing another multimethod: another idea might be to register something on the protocol var: like, this protocol extends these registered types. I think I'm already doing that somewhere, not exactly sure, but you'll see it in the satisfies? implementation if it's still there

lilactown15:07:33

yeah I think that makes more sense too

lilactown15:07:43

I'll try that

lilactown16:07:14

the only time I think we need to do that is for extending default in CLJS and Object in CLJ, to differentiate between "this has protocol does not match this object" and "this protocol matches every object"