tolitius / mount

managing Clojure and ClojureScript app state since (reset)
Eclipse Public License 1.0
1.22k stars 88 forks source link

[CONTINUED] Self-host ClojureScript support #97

Closed arichiardi closed 6 years ago

arichiardi commented 6 years ago

This patch makes mount self-host compatible so that it can be used in environments like lumo, planck, etc.

It is a duplicate, and most of the work has been done by @dm3 in #85.

The patch also adds a package.json file, which can be used for deploying to npmjs, which is the JS/node equivalent of Maven Central.

Lumo can currently read sources for npm, see here.

Finally, I have added minimal testing and lein-tach plugin to project.clj, it can be tested with:

npm install -g lumo-cljs
lein tach lumo
arichiardi commented 6 years ago

Done, this seems to work fine with no warnings in boot test-cljs-advanced.

tolitius commented 6 years ago

niice. thank you @arichiardi and @dm3.

tests do run. I have a question about package.json, how is the version used (i.e. "version": "0.1.12") would it need to increment for every subsequent release?

arichiardi commented 6 years ago

Yeah well npm publish usually takes care of bumping so you can try and play with that. Ideally they follow the same versioning.

The nice thing is that package.json is very easy to parse and could be used as centralized version, read by lein...up to you though :)

tolitius commented 6 years ago

I see. since I have a very limited self hosted cljs experience, do we need any additional docs / samples (maybe via lumo) to expose this support?

arichiardi commented 6 years ago

Well ideally yes but it is ClojureScript after all... A nice addition would be to describe how to use it through npm, or point to the lumo wiki.

I will for sure add mount in here

tolitius commented 6 years ago

sounds good. thanks again for the time spent on this.

arichiardi commented 6 years ago

Thanks for merging and for mount!

Let me know if you need some assistance for npm npm pack creates the tarball so you can see what you are deploying.

tolitius commented 6 years ago

released as @tolitius/mount

birdspider commented 6 years ago

so does it matter now if one includes

mount {:mvn/version "0.1.12"} via deps.edn or :npm-deps {"@tolitius/mount" 0.1.12"} via build.clj

furthermore is (mount/in-cljc-mode) needed, how does the npm and clojars versions differ in usage ?

arichiardi commented 6 years ago

So there is a caveat, the npm deps can be read natively only by lumo.

The JVM compiler does not know how to read sources from it.

It can be a feature request though.