melos icon indicating copy to clipboard operation
melos copied to clipboard

Question: Flutter key commands don't work

Open isacjunior opened this issue 3 years ago • 7 comments

When I execute a flutter package with flutter run, the command inserted in the terminal doesn't work. The classic example for this is to use Hot reload inserting r. Exist some workaround?

start:
  run: melos exec -c 1 --scope="app" -- "flutter run"

Screen Shot 2021-04-07 at 23 33 07

isacjunior avatar Apr 08 '21 02:04 isacjunior

This is not supported at the moment, but can be added

One question though: Would you mind if the command is instead:

start:
  run: cd packages/app && flutter run

?

Because melos exec is potentially executed across multiple packages. So it's a bit unclear how user inputs would work.

rrousselGit avatar May 27 '21 12:05 rrousselGit

When I looked at implementing this a while back I was only going to support it in singular form e.g. it'd only be enabled if either of the following is true:

  1. if --concurrency is equal to 1 on exec
  2. if workspace packages length is equal to 1 (e.g. a single package has been filtered)

So in the case of the example above, -c 1 is set therefore it'd work here

Salakar avatar May 27 '21 12:05 Salakar

I'm not really a fan of such dual behavior. I could see it being misleading, where users would get confused why inputs work in some cases but not others

rrousselGit avatar May 27 '21 12:05 rrousselGit

Especially the "if workspace packages length equals 1"

That could silently fail if a project started with one package but packages were added later.

rrousselGit avatar May 27 '21 12:05 rrousselGit

any updates in this feature request?

ilyosbekkk avatar Dec 17 '22 20:12 ilyosbekkk

@ilyosbekkk Nothing new yet on this issue.

blaugold avatar Jan 03 '23 20:01 blaugold

we also have use for this. my project uses a more complex flutter run that has different flavors for our different environments and we wanted to make it easier for our developers to run any of these.

opanitch avatar Nov 07 '23 16:11 opanitch