How do I set up a lefthook in monorepo, housing several disparate Python projects? #1078
-
|
I'm looking for the pre-commit alternative that supports a monorepo design. Our repository consists of numerous independent projects (mostly Python), each with their own I know that we cannot continue with pre-commit because
It is also worth noting, that unless someone volunteers to fork pre-commit, these features are unlikely to be implemented (pre-commit/pre-commit#1110 (comment)) How does lefthook support large monorepos? Does it support configuration nesting in subdirectories? Is there a way to specify a files to run on with a wildcard? The latter should be pretty-simple to do, and would be a viable walkaround for us in the time-being. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Hey! Lefthook has a few features for monorepo, but it still has the main configuration file in the repo root. However you can split the configuration across subfolders, for example: # lefthook.yml
extends:
- project1/lefthook.yml
- project2/lefthook.yml# project1/lefthook.yml
pre-commit:
jobs:
name: 'Project 1'
root: project1/
group:
jobs:
- run: ... whatever command to run within project1/ group
- run: ...# project2/lefthook.yml
pre-commit:
jobs:
name: 'Project 2'
root: project2/
group:
jobs:
- run: ... whatever command to run within project1/ group
- run: ...See Lefthook will merge all files in |
Beta Was this translation helpful? Give feedback.
-
|
Hello, I’m currently migrating from Husky + lint-staged, and before finding this discussion I found it quite confusing to follow the documentation to achieve this setup. I think the section covering monorepositories with shared configuration could benefit from more clarity and emphasis. Thank you very much for this fantastic open source project! |
Beta Was this translation helpful? Give feedback.
Hey! Lefthook has a few features for monorepo, but it still has the main configuration file in the repo root.
However you can split the configuration across subfolders, for example:
See
jobs,group,rootoptions documentation.Lef…