fix: packageFilters in melos.yaml should not be allowed for a 'run' script
- Dominant language
- Dart
- Stars
- 1.5k
- Forks
- 259
- Avg merge
- 2h 57m
- Merged PRs (30d)
- 21
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues.
### Version
3.1.1
### Description
`melos.yaml` allows the following configuration:
```yaml
name: foo
packages:
- .
- packages/*
scripts:
analyze:
run: dart analyze
packageFilters:
dirExists:
- lib
```
This will show the prompt to choose the package to run the command for, but no matter what is chosen, it is still run in the root folder.
### Steps to reproduce
1. Configure a script with `run` (no `exec`) and package filters, and invoke it with `melos run myscript`.
2. Choose a package other than the root package.
### Expected behavior
As package filters make no sense for `run` scripts (the `run` command doesn't support them either), `melos.yaml` should be validated and report an error in this case. As of now it is very confusing as Melos behaves as if it did allow filters for `run` scripts, but then executes in the root anyway, no matter what the user chooses.
### Screenshots
_No response_
### Additional context and comments
_No response_
Contributor guide
Research direction
Start by locating Melos configuration validation for scripts with packageFilters, then reproduce the behavior with a melos.yaml script using run and invoke melos run. The change is done when this configuration reports a validation error instead of prompting for a package, with regression coverage for the invalid combination.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100