Closed xsahil03x closed 4 months ago
--include-dependents Include all transitive dependents for each package that matches the other filters. The included packages skip --ignore and --diff checks.
This is not a bug, it is how it is intended to work, and also how the docs describe it.
--include-dependents Include all transitive dependents for each package that matches the other filters. The included packages skip --ignore and --diff checks.
This is not a bug, it is how it is intended to work, and also how the docs describe it.
Thanks, i missed.
Hey @xsahil03x, I ended up implementing the approach of setting the global MELOS_PACKAGES
filter with the values from melos list --diff=origin/main...HEAD --include-dependents
in the CI pipeline for our big project.
The approach is described in https://itnext.io/flutter-selective-ci-checks-2d79ffbd26e5 article. Hopefully, it may be a workaround for you as well!
Is there an existing issue for this?
Version
5.2.1
Description
Currently, the order in which melos exec calculates the packages are as follows:
https://github.com/invertase/melos/blob/main/packages/melos/lib/src/package.dart#L597-L628
filters
(eg: applyIgnore, applyDirExists, applyFileExists)applyDiff
applyIncludeDependentsOrDependencies
if enabledBecause we are executing
applyIncludeDependentsOrDependencies
at the last step, the added packages skips all the filters applied on the first step. So even tho a package is skipped in the first step, it can re-appear through the lastapplyIncludeDependentsOrDependencies
step.Steps to reproduce
Suppose we have a monorepo with 2 packages.
Now if we try to run the command:
melos exec --fail-fast --dir-exists="test" --diff=origin/main...HEAD -c 1 --include-dependents -- flutter test
Ideally the command should only run for
Package B
asPackage A
contains no test. But in the current implementation it will also includePackage A
as it depends onPackage B
.Expected behavior
The
filters
should also be applied ondependents/dependencies
.Screenshots
No response
Additional context and comments
No response