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

[Feature] yarn workspaces foreach --since #2374

Closed
2 tasks done
jdanil opened this issue Jan 14, 2021 · 2 comments · Fixed by #3459
Closed
2 tasks done

[Feature] yarn workspaces foreach --since #2374

jdanil opened this issue Jan 14, 2021 · 2 comments · Fixed by #3459
Assignees
Labels
enhancement New feature or request

Comments

@jdanil
Copy link
Contributor

jdanil commented Jan 14, 2021

  • 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,

@jdanil jdanil added the enhancement New feature or request label Jan 14, 2021
@paul-soporan paul-soporan self-assigned this Jan 14, 2021
@alexlafroscia
Copy link

alexlafroscia commented Mar 19, 2021

It looks like this plugin intends to serve a similar function, though it would be nice to have this supported first-class as well!

https://github.com/Dcard/yarn-plugins/tree/master/packages/changed

@jdanil
Copy link
Contributor Author

jdanil commented Mar 22, 2021

This looks like a great stopgap. Thanks for sharing @alexlafroscia!

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

Successfully merging a pull request may close this issue.

3 participants