Fork me on GitHub
#tools-deps
<
2021-06-28
>
metasoarous23:06:20

Does anyone know if it's possible for deps.edn aliases to refer to or reuse each other? This would be pretty handy in certain scenarios, but doesn't seem to be possible. https://stackoverflow.com/questions/68170875/how-do-you-refer-to-or-reuse-one-alias-from-another-using-deps-edn

practicalli-johnny06:06:13

It is possible to use many aliases with each other as has been stated in the stack exchange post, by chaining them together I have found that explicitly including the aliases used to be much clearer as to the intent of the command and offers far greater flexibility. Defining relationships between aliases seems like it could lead to greater complexity in the design and levels of abstraction behind what is otherwise can be a very clear chain of aliases. Once you can have an alias depend on another, what is the precedence of any conflicting configs between aliases? Would we also need to have an excludes mechanism, as with dependencies?

metasoarous19:06:44

> Once you can have an alias depend on another, what is the precedence of any conflicting configs between aliases? Would we also need to have an excludes mechanism, as with dependencies? This is a great question/point! This is one clear argument for using a vector of aliases to be referred to instead of a set. Then "last wins", just as when you explicitly list several aliases in a cli invocation.

metasoarous19:06:33

However, I don't know if much more is needed really. As long as there's no cycles (which should be an error), seems like you can simply resolve each alias by itself, and chain together the data from each such resolution at the next level up the tree using order for precedence, etc.

metasoarous19:06:30

I think in many cases you are correct that explicitly listing out aliases may be advantageous. But I'd argue there are many others where it's pretty harmless, and saves folks a docs headache realizing that "oh, the alias I was trying to use doesn't work because I needed to include this other alias..."

practicalli-johnny21:06:41

I have not experienced any docs headache when creating over 30 aliases for https://github.com/practicalli/clojure-deps-edn So I am afraid I am not able to relate to this point

seancorfield23:06:50

@metasoarous It is not possible. But it is something people have requested quite often. You can vote for it here https://ask.clojure.org/index.php/10564/specify-an-alias-that-is-a-set-of-other-aliases

👍 3
metasoarous23:06:24

Thanks for confirming, and pointing to the ticket!

seancorfield23:06:26

We currently run our monorepo build script with clojure -M:build:everything:dev:test:runner build.clj ... and it sure would be nice to have :build be able to automatically "include" :everything:dev:test:runner!

✔️ 6