Closed paulstatezny closed 2 years ago
This might also be a good opportunity to revisit the "rules" for specifying mix/lib deps.
Right now, unlisted mix deps are always included and unlisted lib deps are never included. If you try to reference an unlisted dep it errors.
But it may be smoother and more intuitive if it automatically detects both kinds of deps. And you only need to specify them if you want to attach options.
Which would be a better API for specifying which mix/lib dependencies are always ejected?
:always
optionmix :norm, always: true
mix :mint
mix :phoenix, always: true
lib :my_ui_components, always: true
lib :my_data_source
lib :my_auth_library, always: true
Pros:
always
macroalways do
mix :norm
mix :phoenix
lib :my_ui_components
lib :my_auth_library
end
mix :mint
lib :my_data_source
Pros:
*Counterpoint: there may still be transitive deps that are always included but outside the always
block, but that's not a problem unique to this solution.
Done in #11
Instead of having a
modify
function where you have to return a list of tuples, we could have macros.We could make you specify a
Modify
module in config, and then do something like this:The atom, e.g.
:tests
would map to a function in yourModify
module.Alternative for this might be:
Instead of defining a
lib_deps
function, we could do something like:Similarly, for mix deps:
The different types of things you can return in
base_files
could be their own macros.For the
ejected_app
option from theoptions/1
callback, we could have a macro that takes the same options aslib
:(Unrelated: should we rename the fields in
app.name
to something less "jargon-ey"?name.underscore
instead ofname.snake
, etc.)Note in the above code snippet the syntax where you "bind" the
app
to a variable. If that's possible, we could make that option available in other callbacks where we currently reference the app. For example: