Reputation: 9766
I have a project that sits in a monorepo. That monorepo is been shared among a lot of projects with different types. I have a React project with NPM in this monorepo.
We are using VSCode for the development of this repo, since there are verity of people (experts and less experts) that touch the code, I want to make the process as easy as possible to prevent issues for everyone. For example, run npm install
if the package.json
file has changed.
Since it is a monorepo, no one is allowed to create git hook for a specific sub project. So I search for a solution of "local git hooks" that will not impact other projects.
Since we are using VSCode and open the root project directory in it, is there any way to create "local" git hooks in VSCode? For example, if someone run git pull
in the VSCode the VSCode will execute additional command after like a hook?
Upvotes: 1
Views: 4820
Reputation: 86
We've been in a similar situation and ended up using Husky in conjunction with Yarn Workspaces
It's been working great for us - the only thing that every developer needs to know is to run yarn
after cloning, and all tools will be installed.
The only caveat in your situation is that you will need to write your own hook for e.g. running npm install
if the pulled commits contain package.json
changes, but that shouldn't be very hard to do - husky
hooks are plain bash
scripts after all.
Upvotes: 1