My .husky
placed in the parent directory. in the child I have the nx workspace
code. in this case how can I add the reference link to check my script in the parent directory?
parent/
├─ nx-workspace/
│ ├─ package.json
│ ├─ apps
│ ├─ libs
.git
.husky
here the package.json scripts should read the git and husky details.
CodePudding user response:
In the pre-commit
hook, we can get the absolute path to the .git directory by
git rev-parse --absolute-git-dir
And then it's easy to get the path to other directories if we know the folder structure.