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

Implement --filter RFC #887

Merged
merged 14 commits into from
Mar 23, 2022
Merged

Implement --filter RFC #887

merged 14 commits into from
Mar 23, 2022

Conversation

gsoltis
Copy link
Contributor

@gsoltis gsoltis commented Mar 15, 2022

Implement #105

@vercel
Copy link

vercel bot commented Mar 15, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/vercel/turbo-site/HXZTf93tyXZqrnkDKL5ysm5pw8Tm
✅ Preview: https://turbo-site-git-gsoltis-filter.vercel.sh

jaredpalmer
jaredpalmer previously approved these changes Mar 15, 2022
Copy link
Contributor

@jaredpalmer jaredpalmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change the pipeline delimiter for topological relationship to be ... instead of ^? We would need a codemod

@weyert
Copy link
Contributor

weyert commented Mar 18, 2022

Looking really powerful! I can't wait to try this out in the canary :)

@gsoltis
Copy link
Contributor Author

gsoltis commented Mar 18, 2022

Some review notes:

  • Some pieces of the RFC are not yet implemented. In particular, --test-pattern and --filter-prod are not implemented. The existing --ignore flag is respected as --changed-files-ignore-pattern.
  • Docs are still a TODO. I'm open to suggestions on how much detail to include in the help text for run. I suspect that including a full syntax reference for filters might be too much, but we ought to have a link to the docs at the very least.
  • We added an extra piece of syntax to pnpm's syntax: the ability to specify leading ... before a commit reference. When specified, we use a different algorithm for selecting packages: first we filter all packages that match package and directory filters. Second, we further filter that list of packages to include only the packages whose dependencies have changed since the specified commit. This enables the usecase of selecting a package if it or any of its dependencies have changed.
  • The algorithm in filter.go is largely a port of the corresponding filtering in pnpm, with the exception of filterSubtreesWithSelector, which implements the above additional feature.
  • filter_test.go is largely a port of pnpm's test for filter
  • parse_target_selector_test.go is a port of pnpm's test for parsing selectors
  • match_test.go is a port of pnpm's matcher test

@gsoltis gsoltis marked this pull request as ready for review March 18, 2022 18:26
@gsoltis gsoltis requested a review from gaspar09 as a code owner March 18, 2022 18:26
@jaredpalmer jaredpalmer changed the title Implement --filter Implement --filter RFC Mar 18, 2022
…bsolute platform-dependent path as I had been specifying in tests
@weyert
Copy link
Contributor

weyert commented Mar 21, 2022

@gsoltis How much do you think is left for this PR? I am wondering if I could help you in someway

@gsoltis
Copy link
Contributor Author

gsoltis commented Mar 21, 2022

@weyert Thanks for your interest. Probably the most helpful thing right now would be some QA. I've ported a good chunk of the tests from the equivalent pnpm modules, but it's helpful to try with actual commands someone would run. So, can you try building from this branch and see if you are able to express the commands you would want? Especially with --dry, you should be able to verify that the targets you expect are getting run.

@weyert
Copy link
Contributor

weyert commented Mar 21, 2022

@gsoltis Yeah, I have build for the Mac. I haven’t been able to make a build for Linux yet. Maybe a canary build would help to test this PR? Can imagine that would be useful for @pablo-abc too

@weyert
Copy link
Contributor

weyert commented Mar 22, 2022

@gsoltis Will it support the upcoming --filter change in NPM v7?

Filtering by path is done by globs.

In pnpm v6, in order to pick packages under a certain directory, the following filter was used: --filter=./apps

In pnpm v7, a glob should be used: --filter=./apps/**

Source: https://github.com/pnpm/pnpm/releases/tag/v7.0.0-beta.2

@rxliuli
Copy link

rxliuli commented Mar 22, 2022

I would like to release one version first and the next version to support the changes in pnpm v7, we have been waiting for this feature for too long

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants