You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/README.md
+14-3
Original file line number
Diff line number
Diff line change
@@ -86,11 +86,22 @@ If `npm test` command fails, your commit will be automatically aborted.
86
86
87
87
It's recommended to add husky in root `package.json`. You can use tools like [lerna](https://github.com/lerna/lerna) and filters to only run scripts in packages that have been changed.
88
88
89
-
## Subdirectory
89
+
## Custom directory
90
90
91
-
By design, `husky install` must be run in the same directory as `.git` but you can indicate where your git hooks are.
91
+
If you want to install husky in another directory, for example `.config`, you can pass it to `install` command. For example:
92
92
93
-
For example, if your `package.json` is in a subdirectory (.e.g `front/`), you can change directory during `postinstall` and specify where your git hooks are:
93
+
```
94
+
// package.json
95
+
{
96
+
"scripts": {
97
+
"postinstall": "husky install .config"
98
+
}
99
+
}
100
+
```
101
+
102
+
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`.
103
+
104
+
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:
0 commit comments