Is that possible? For now I use ClojureScript and I have to distribute the command line to npm after compiling to JavaScript. Can I just distribute it to Clojars?
No, this is not possible if you want it to work like npm
.
Clojars is just a maven repository, it just hosts data/files. Similar to the npm
registry. It is basically just a static webserver serving files. There is no npm
command line utility but the new deps.edn
related stuff is close.
You can create an ns like
(ns your.lib)
(defn -main [& args]
(prn args))
publish it to clojars under your.lib
with some version. Then to use it create a deps.edn
with
{:deps {your.lib "some-version}}
and run it with clj -m your.lib more args
I’m still expecting…
meyven global add respo/composer-app
composer-app # ...my app runs
That does not exist.
I’m sticking with npm.
Clojure or ClojureScript? I’m not sure about ClojureScript, but for Clojure, I’ve found using a clj alias to be awesome.
Just keep adding aliases to your ~/.clojure/deps.edn
, one for every Clojars cli you want.
Then just run whichever you want: clj -A:command
So the global install
process is just adding an alias entry to your ~/.clojure/deps.edn
. This is cool, because say you change machine, or re-install your OS, or wtv. You can just drop your deps.edn file back and boom, all your commands are installed again.
If you want to shorten the command so clj -A:command
becomes just command
I use shell alias, which I add to .zshrc (I’m a zsh user).
ClojureScript mostly.
Hum, ya for ClojureScript I’m not sure. Things get more complicated. Especially if you use npm for dependencies I think. If all your dependencies are in clojar, maven or git, you might still be able to use clj tool. But I think you’d need an additional runner script which can start Node for you. Since clj can’t do that out of the box I believe.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.