How do I publish a clojurescript library?

clojurescript
clojure

#1

It’s easy enough to publish my clojure libraries to clojars. What do I need to do for a clojurescript library? For example, one intended for use with reagent? In the end it should be something that can just be included in your lein dependencies. Is there a difference to the process?


#2

The guide told that they are the same publishing Clojure and ClojureScript code to Clojars. Just bunding them in a jar file with pom.xml and send to Clojars then they can be used from source-paths. You can try and it will work.

Maybe there are differences how the jars are created within a Java environment with Clojure runs. The step appears same to me.


#3

@Webdev_Tory the process is identical, you can publish jars with .clj/.cljs/.cljc code to Clojars and there’s nothing special about those jars. There is no difference between how e.g. Reagent and compojure are packaged.

Dependencies work the same way in the regard that you can specify arbitrary Maven dependencies. Some projects/libraries may require NPM dependencies for which there is no mechanism at this point as far as I’m aware.


#4

You can include a deps.cljs with a :npm-deps map at the root. shadow-cljs supports this out of the box. The CLJS compiler needs to be configured with the :install-deps true option for them to be installed otherwise.

Example deps.cljs

{:npm-deps {"react" "16.4.1"}}

Given that webpack is now the official recommended way to include NPM dependencies I’m unsure how this feature will be used in the future.