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

feat(workspace-tools): add path support to --include, --exclude, and --from flags in foreach #5308

Merged
merged 5 commits into from
Mar 27, 2023
Merged

feat(workspace-tools): add path support to --include, --exclude, and --from flags in foreach #5308

merged 5 commits into from
Mar 27, 2023

Conversation

me4502
Copy link
Contributor

@me4502 me4502 commented Mar 6, 2023

What's the problem this PR addresses?

Quite often, repos are laid out where workspaces are grouped by directories, but the workspace identifier is kept as the package name. This makes it hard to run a command on all workspaces that are within a libs directory for example, using the existing yarn workspaces foreach command.

How did you fix it?

This PR adds path support to the --include, --exclude, and --from flag in the foreach command in the workspace-tools plugin, allowing filtering of workspaces by relative path.

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

Copy link
Member

@merceyz merceyz left a comment

Choose a reason for hiding this comment

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

I think we should instead extend the current options to support paths as well as idents, the --from option should also be covered.

@me4502
Copy link
Contributor Author

me4502 commented Mar 9, 2023

@merceyz My concern about doing that was that it's technically a breaking change if someone had idents & paths that both matched the same format - but I'm happy to make that change if it's not really a concern (as it'd be fairly unlikely)

@me4502 me4502 changed the title feat(workspace-tools): add --include-paths and --exclude-paths flags to foreach feat(workspace-tools): add path support to --include, --exclude, and --from flags in foreach Mar 16, 2023
@arcanis
Copy link
Member

arcanis commented Mar 23, 2023

That looks good to me - @merceyz, have your concerns been addressed?

@arcanis
Copy link
Member

arcanis commented Mar 27, 2023

Will go ahead and merge it to ship it in the next RC

@arcanis arcanis merged commit 43578c8 into yarnpkg:master Mar 27, 2023
@merceyz
Copy link
Member

merceyz commented Mar 27, 2023

That looks good to me - @merceyz, have your concerns been addressed?

Yes, I missed the notification, sorry about that.

@me4502 me4502 deleted the feature/workspaces-foreach-path-filters branch March 27, 2023 23:37
@krinoid
Copy link

krinoid commented Jul 4, 2023

Thanks for this change, @me4502!
@arcanis was this feature ever released in v3? I can't find it in the CHANGELOG and when applying the latest version (yarn set version latest) and running yarn workspaces foreach --help I still see the older help page, compared to the master (https://github.com/yarnpkg/berry/blob/master/packages/plugin-workspace-tools/sources/commands/foreach.ts#L98).

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