leiningen 2021-11-22

Is there a way to retrieve data from somewhere in project.clj and put in :aliases? For example, I'd like to configure :figwheel-main in some profiles and then be able to pass those configs to the figwheel launch command in :aliases.

I don't get what you want exactly, can you rephrase it? (perhaps without mentioning figwheel)

Sure:

{:profiles {:A {:compiler :config-map}}

 :aliases ["with-profiles" "A" "run" "m" "something.main" "-co"
           #=(pr-str ***COMPILER***)]}
I'd like to fill ***COMPILER*** with the data from :compiler as defined in the profile.

(def data {:compiler :config-map})

(defproject foo :profiles {:A ~data})

before defproject you can def/defns, without any special syntax required

inside defproject you can use ~ to eval arbitrary expressions, within which you can refer to any prior def/defns

Right, but then I can't extract the merged profiles, can I?

👀 1

if you don't want pure data but the result of a Lein computation, that sounds like something that plugins/middleware can do

I was afraid of that 🙃

the fn receives a project map as an argument from Lein, probably with all profiles merged?

Oh an inline middleware, that's very interesting

I'll explore this path, thank you very much!

🍻 1