Search code examples
gityarnpkgyarn-workspaces

How to run command on each workplace, which has changes since last commit?


I am trying to run the command on workplaces, which were changed since last commit:

 yarn workspaces foreach --verbose --since --no-private npm info

My yarnrc.yml includes this setting to specify the previous commit

changesetBaseRefs:
  - HEAD~

But it still runs on all workspaces.

I tried checking changes with

yarn version check

And it shows the exact 2 packages that were changed.

Do you have any ideas on how to do it?


Solution

  • You need to add -R tag

    yarn workspaces foreach --since --no-private -R npm info
    

    Find packages via dependencies/devDependencies instead of using the workspaces field. Here you can read more: https://yarnpkg.com/cli/workspaces/foreach#options-R%2C-recursive