clojurescript-npm
clojurescript-npm copied to clipboard
Dependencies
How do I declare and acquire ClojureScript dependencies from node? Do we implement project.clj
and defproject
? Something like we did in Arcadia?
I'm got some code to recursively get dependencies for a given (group, artifact, version)
tuple. I'm gonna expand on it in my free time.
I've taken some inspiration from the Arcadia code.
Awesome! I was looking at xml2json as well. Glad the Arcadia code could be helpful.
All the async operations make the code slightly convoluted. But core.async atleast makes it possible without the callback hell.
I should have something which lets you download all the dependencies into a particular directory soon enough.
Just a thought: I think the biggest use case for this project beyond the cljs-repl could be to finally enabling cljs as a scripting language. so something like this but for clojurescript.
The issue with using leiningen
etc is that you have to spin up a jvm and load Clojure which isn't a quick option whereas this would be as it would be using node.
I agree. The REPL is an important step, but my real goal is scripting and embedding in frameworks like electron. Startup time is better than the JVM, but we still have to parse the ~6Mb of javascript that is the cljs language, compiler, and standard library, so there's a ~1s hiccup when we load.
good point. hmmm...
btw, I maintain a leiningen template which creates all the scaffolding required for an electron project. It is here. I've used it for a 10k+ loc project at work.
Nice! I've used https://github.com/Gonzih/cljs-electron in the past. I am just trying to get away from lein and generated scaffolding...
I've updated my code to be able to fetch all the dependencies for a give project and download them into a given folder.
Amazing! I will check it when I get the chance.
sweet. obviously this downloading code can be improved but it is just a start. Currently I am only downloading the jar and not checking for signatures etc. I'd like to implement that as well so that it is at par with leiningen and boot etc.
An idea I had for specifying the dependencies for the script is to specify them as comments on the top of the file. This way the file could be self contained. just an idea though.
that's a great idea, I'd like it if it's more like the grape type stuff you find in groovy http://docs.groovy-lang.org/latest/html/documentation/grape.html
maybe we can have a fn at the begging of the file that pulls of the dependencies before it executes
Interesting precedent. Makes me think of F#'s #r and #I scripting stuff.