Hi everyone, do someone knows if there is a way to pass data to a clojurescript project (Reagent) when building from leiningen?
What I would like to do it get the last commit information from the git repo inside the clojurescript project, and pass that information to my project to be able to display it inside the build
The more general question would be if there is a way to trigger some Clojure code when calling a build command like lein package
Maybe there's a more straightforward answer to your questions, but I've used :filespecs
to grab git information and package it during lein uberjar
https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L432
I'm not sure how a clojurescript build differs as filespecs
is specifically for adding things to a jar file.
Mmmmh thanks for the answer, I’ll check it out! 😃
@elkiwydev you can pass things to CLJS via :closure-defines
as well
this may be reasonable for some usages
within a :cljsbuild
in lein project:
:closure-defines {your.project.ns.name.SOME_DEF ~(find-some-dynamic-build-info)}
And you could do a
(defn find-some-dynamic-build-info []
;; lookup things here )
in top of project.clj above the defproject
declarationwhich in this case, looks like you’d probably be shelling out to git
but it’s pretty open with what you want to do to get whatever information
Thanks @mikerod, I’ll look for that too!