Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify scripts that are meant to be executed on multiple packages #266

Closed
lukepighetti opened this issue Mar 29, 2022 · 4 comments
Closed
Assignees

Comments

@lukepighetti
Copy link

lukepighetti commented Mar 29, 2022

If I try to use select-package.dir-exists to scope a command to only packages that contain the ios directory, when I try to run the command it gives me a user prompt instead of running it on all packages like melos exec --dir-exists="ios"

  upgrade:pods:
    select-package:
      dir-exists: 'ios'
    run: |
      rm -rf Pods Podfile.lock
      pod repo update
      flutter precache --ios
      pod install

The user prompt it creates instead of running on all of them automatically

% melos upgrade:pods
Select a package to run the upgrade:pods script:

1) * [Default - Press Enter]
2) example
3) ml_pose_detection
4) timeline_player
5) tonal
6) tonal_ar


? Enter your choice 
@lukepighetti lukepighetti added feature request Needs: Triage The issue needs triaging labels Mar 29, 2022
@lukepighetti lukepighetti changed the title request: Cannot use dir-exists to run multi-line command Mar 29, 2022
@blaugold
Copy link
Collaborator

blaugold commented Mar 29, 2022

You can skip the prompt with the --no-select option, e.g. melos run upgrade:pods --no-select

@lukepighetti
Copy link
Author

lukepighetti commented Mar 30, 2022

That appears to run the default (option 1), which only appears to be a single package. I would like to run it on all packages that meet the dir-exists (and any other filter I may wish to use). My expectation was that it would work like melos exec

@blaugold
Copy link
Collaborator

Ah, I see. You need to use melos exec in run:

  upgrade:pods:
    select-package:
      dir-exists: 'ios'
    run: |
      melos exec -- \
      rm -rf Pods Podfile.lock && \
      pod repo update && \
      flutter precache --ios && \
      pod install

It's not the nicest syntax because it needs to be a single command. There is some room for improvement here :)

@lukepighetti
Copy link
Author

lukepighetti commented Mar 30, 2022

I would expect that to run melos exec in just the default package. While it does solve my problem, I find this highly confusing. It's not clear to me how the results of select-package are being passed to melos exec

In an ideal world we'd be doing something like this

  upgrade:pods:
    filter:
      dir-exists: 'ios'
    run: |
      rm -rf Pods Podfile.lock
      pod repo update
      flutter precache --ios
      pod install
$ melos upgrade:pods

And then it runs on

example
ml_pose_detection
timeline_player
tonal
tonal_ar

@blaugold blaugold removed the Needs: Triage The issue needs triaging label May 22, 2022
@blaugold blaugold changed the title Cannot use dir-exists to run multi-line command Simplify scripts that are meant to be executed on multiple packages May 22, 2022
@blaugold blaugold self-assigned this Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants