Skip to content

[Feature] yarn workspaces foreach --sinceΒ #2374

@jdanil

Description

@jdanil
  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

Describe the user story

In a monorepo with several workspaces, I'd like to be able to just run jobs on the changed workspaces.

For instance...

  • on pull requests I'd like to just run verification on the changed packages (and any dependent packages), or
  • on master builds I'd like like to just build and publish changed packages (and any dependent packages).

This will help save time running jobs like verification on unchanged packages.

Describe the solution you'd like

I'd like to propose adding a new --since option to the foreach command in the workspace-tools plugin.

The --since option would take a ref to diff against.

e.g.

  • yarn workspaces foreach --since (use latest git tag?)
  • yarn workspaces foreach --since master
  • yarn workspaces foreach --since <commit hash>

Describe the drawbacks of your solution

I'm not familiar with other SCM tools like subversion or mercurial, so I'm not sure whether they have "refs" that could be diffed against, or if yarn berry even supports SCM tools other than git.

Describe alternatives you've considered

I think this functionality wouldn't be added as a plugin as it doesn't really affect the purpose of the foreach command, its simply filtering which workspaces the command runs against, similar to existing options like --include and --exclude.

There are other dependencies that could be used, like lerna (which supports a similar option). But lerna doesn't fully support yarn v2 (lerna/lerna#2449). Also, my understanding is that the workspace-tools plugin (as well as plugins like version) intend to make additional dependencies like lerna unnecessary,

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions