Not a direct response to your proposal, but a handy rubber duck tip, in the 
case of `npm install` you can use the `--prefix` option to avoid changing 
directory from project root, even with umbrella apps I don't find myself 
leaving the project root directory in my nvim / shell / server terminal setup.

Cheers
Jon

On Fri, 21 Jan 2022, at 6:32 AM, Benjamin Philip wrote:
> Hi,
> 
> As of Elixir 1.13, project specific mix tasks such as `mix test`, can only be 
> called from project root.
> 
> This is okay when I have to run `npm install` in the `assets` directory in a 
> phoenix project,  but has the side effect of making repetitive tasks/commands 
> in a subdirectory quite tedious (because I have to cd a lot), especially if I 
> have to run a mix task after running the command.
> 
> Naturally, I have 2 shell sessions while developing - one for running mix 
> tasks, and the other for actual development - editing files, running commands 
> etc. Switching between the two sessions can mean using a quick keystroke at 
> best, or removing my hands from keyboard and using the mouse at worst. This 
> can quickly become irritating if I have to switch sessions often and I don't 
> know the keystroke for my terminal.
> 
> The rake <https://github.com/ruby/rake> build tool on the other hand, allows 
> for calling rake in a project subdirectory by changing rake's working 
> directory to project root using this function 
> <https://github.com/ruby/rake/blob/5c60da8644a9e4f655e819252e3b6ca77f42b7af/lib/rake/application.rb#L678-L688>.
>  Rake then runs the required task.
> 
> This would not be possible for example make, where the buildlogic (Makefiles) 
> are found in directories with project source code.
> 
> However, rake has all build logic in a Rakefile, or in the `rakelib` 
> directory. Similarly, mix has all tasks in `lib/mix/tasks/`. Thus, I feel 
> allowing mix to be called in project subdirs, will not have any problems.
> 
> I propose that mix allows project specific mix tasks to be called in a 
> project subdirectory.
> 
> Regards,
> Benjamin Philip
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/71e3417b-ae1c-48e3-92f3-524d232f88d0n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/71e3417b-ae1c-48e3-92f3-524d232f88d0n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/095e5609-7279-43f2-bf59-30e3777583db%40www.fastmail.com.

Reply via email to