Closed pastre closed 7 months ago
Can't you just do something like this instead? :thinking:
scripts:
test:
name: Run unit tests on an specific package
run: cd $1 && flutter test
And then run it with:
$ melos test your_packages
If it's just for packages I would advice using the MELOS_PACKAGES
environment variable instead though.
I don't think we want more ways to do this.
Oh I didn't know it'd forward the arguments :D Thanks!
Is there an existing feature request for this?
Command
No response
Description
Just like Makefile has the
%
wildcard, this proposal aims to introduce a wild card for custom scripts. This would give us flexibility to write reusable scripts that take arguments on their namesReasoning
A use case would be to run scripts without the menu - it's more efficient to just type instead of searching for an option in the menu. Also allows for more creative rules
Additional context and comments
My initial proposal is to have the asterisk (
*
) character symbolise a wild card. We would only accept one wild card per rule, and just like make, replace each occurrence of the*
character before executing the rule. Example: Given the following workspace descriptionwhen we run
melos test:my_package
then we expect the following command to be executed:
cd my_package && flutter test
I can already see some conflicts arising with this suggestion (e.g.: what if my command runs
ls *
, how would we differentiate the*
with the variable?), so that's why I'm raising this here and looking for suggestions.I'm happy to come up with an implementation, as soon as the idea is a little more concrete :) Thanks in advance!