-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Why does husky findUp git? #502
Comments
Hi @G-Rath, It's because some users have their package.json in nested directory and can't move it to Git root. That seems to happen mostly with enterprise projects. .git
front/package.json
back/ # May not be in Node but in some other tech |
Hi @typicode - thanks for the response. That seems a bit weird to me, as why would not be able to move As I've said, IMO if you're going to use So in your example:
Of course, this is my opinion, and I'm sure there are some valid reasons for why that won't work. Either way; that's how it is, and clearly some people have use for it 😄 In saying that, it does make me a little uncomfortable as there's no bail out condition - if I install husky by mistake in a folder w/o git, it'll just keep going up until it reaches the top of the drive (or of course finds a (Ironically, I found the other day I had actually managed to create a git repo of my C:\ drive by mistake, w/o realising it, which is part of the reason why this makes me a little paranoid) Originally, I was going to suggest passing a predicate function to That makes the whole thing a lot simpler: would you be open to having a It should just be a matter of the following:
Let me know if you'd be interested in supporting that, and I'll break it out into a new issue + PR (w/ tests 😬). I think this might solve #499, but suspect I might be not be understanding what the issue is actually about. Alternatively, it could work the other way: change the default behaviour to be only search for |
Just for reference - I am here trying to find a config setting to specify the |
Behavior has been changed in v5. Git dir needs to be specified if it's at a different level than |
I'm breaking this out from #499
I've got a project whose nature requires having multiple mini-projects ("templates") in a directory of the project, all of which are committed to git.
When husky installs, it uses
find-up
to look up recursively until it finds a parent folder w/ a.git
file or folder:husky/src/installer/index.ts
Line 138 in 8b9989f
This means that if you install husky in
root/a/b/c
, it'll setroot/.git
to call husky inroot/a/b/c
.My question is: Why?
Personally, I'd think you'd want to just check if the
package.json
root had a.git
file or folder (so/c
in this example); otherwise you're running scripts that are hidden away in nested folders, and also need to make sure the packages are actually installed if they're critical to your project (or it's flow).It could be I've completely missed a valid use case, hence the question :)
The text was updated successfully, but these errors were encountered: