How To Modify mix deps.compile and other standard mix tasks?

We are provided with several standard mix tasks out of the box and even though helpful to get kickstarted, after experienced usage I would like to customize certain aspects such as:

  1. Not having comments included when doing mix new new_app
  2. Generating one’s own umbrella app folder structure
  3. Being able to define a specific mix task to compile one’s custom project skeleton as defined under point 2.

I would appreciate if someone could point me out where those mix tasks are defined and if not trivial, how to modify them according to one’s personal taste.

EDIT: Here is a direct link to mix task new: https://github.com/elixir-lang/elixir/blob/f80008032ce69e697b031a4a13af13498ac8930b/lib/mix/lib/mix/tasks/new.ex

1 Like

For the project relates tasks you can specify aliases in your mix file.

For mix new I have a shell script which does call mix new and then processes the generated files. I do not strip comments, but I add some standard deps to the mix file and install them.

I’d suggest to keep comments anyway, if not for you then at least for contributors or your future self. Comments are far more than wasted disk space, they are instructions and letters to your future self.

1 Like

Thank you for pointing me in the desired direction. I will be looking at: https://hexdocs.pm/mix/Mix.html

As far as the feedback about commenting goes, I respectfully disagree though. There is a difference between documenting code and having documentation on the usage of a new framework/language primarily catered towards beginners. The latter tends to become noisy.

1 Like

Well even beginners may want to contribute to your project. And it might help them to have these brief instructions. If you still find that they don’t suite your style, you always can create a new project which provides your version of the new via Mix.Task.Ajwah.New, build an archive from it, install that archive.

1 Like