Lerna run only on changed packages

Viewed 833

We have mono repo set up which holds 13 packages. It's very unlikely that we change all of them at any given release. I am trying to find a way to run lerna run .... only on changed packages. I did try with --since master, looks it does not work on master branch. What is the best way I can achieve this? I am thinking of writing a scripts which reads from lerna changed and run those commands.

1 Answers

Depending on what and when (eg precommit) you are trying to run, in general, when on master, simple lerna run test --since should do it. There was a gh issue.

Also, you can look at lint-staged package that could help you. It allows us to run commands against staged files. So if you only changed stuff in packageA - linting, prettiering or running tests inside lint-staged will save you time.

Related