This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-24
Channels
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
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
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
It could work (with some tweaks at least) but you don’t probably want to run npm install on each lambda cold-start.
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)
trying to load my library https://github.com/lilactown/cascade/ results in an error
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\"}}"
the offending line(s): https://github.com/lilactown/cascade/blob/ad3a92128de0eb5a633a0043874d8744626333d7/src/cascade/core.cljc#L491-L498
actually boiled it down to a more general issue with extending protocols https://github.com/babashka/nbb/issues/242
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