typicode / husky-4-to-8

Quickly migrate your hooks from husky v4 to husky@latest
MIT License
131 stars 20 forks source link

failing when using workspaces #6

Closed IcodeNet closed 3 years ago

IcodeNet commented 3 years ago

if you have setup a postinstall in your package.json and you are in workspace i.e. a subdirectory where .git is a few levels up it fails with

$ husky install
.git can't be found
IcodeNet commented 3 years ago

apologies I had to read the docs more thoroughly. ... Another case you may be in is if your package.json file and .git directory are not at the same level. For example, project/.git and project/front/.package.json.

By design, husky install must be run in the same directory as .git, but you can change directory during postinstall script and pass a subdirectory:

// package.json { "scripts": { "postinstall": "cd .. && husky install front/.husky" } }