Closed jogold closed 4 years ago
You could try installing lint-staged
at the package root.
The precommit
call to package which does not have any staged file would be effectively a no-op via lint-staged
if I am not wrong.
The
precommit
call to package which does not have any staged file would be effectively a no-op vialint-staged
if I am not wrong.
It is a no-op but for a monorepo with let's say 30 packages it's a very slow process...
Go through these:
You should be able to tweak lerna run
to pick only the packages which have been modified.
If you are arrive at a solution, would you be interested in contributing to the readme by adding a FAQ section? I think the question your question is worth documenting.
would you be interested in contributing to the readme by adding a FAQ section?
of course
Ever tried this https://github.com/wix-incubator/monorepo-staged-precommit?
No, I haven't tried that. To be completely honest, I have never used a monorepo myself. I originally authored this as an example for usage of lint-staged
.
@jogold Could you try adding --since HEAD
to your pre-commit command? I think this might do the trick.
Edit: This will run the pre-commit hook for a package if it has any changes. Even if they haven't been staged. It's still better than the current behavior though.
@sudo-suhas I ended up doing this: https://github.com/goldwasserexchange/public/blob/chore/global/monorepo/precommit.js
with this:
{
"husky": {
"hooks": {
"pre-commit": "node precommit.js"
}
}
}
@jogold that precommit.js
file returns a 404
@dialex have a look here https://github.com/goldwasserexchange/public/blob/master/precommit.js
Hi,
It seems that with the proposed structure
precommit
is run in each package even those that don't have staged changes. Any idea on how to improve this?