Skip to content
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

Allow installation in the outer .git directory #244

Closed
wants to merge 1 commit into from

Conversation

TETRA2000
Copy link

Hi! I'm participated in a project which has separated frontend/backend directories.
It has a frontend directory as a subdirectory. And I would like to install hooks from the subdirectory.

└───some_backend_repo
    └───.git
    └───frontend
        └───package.json
        └───node_modules
        └─── ....

But husky doesn't allow me to install hooks when package.json is located in another place of .git located.

So I want an opted-in option to install hooks in the outer .git directory.

I implemented to use env variables. So I think this doesn't make bad effects when unwanted.(like #36 )

I hope you to review this pull request.
Thank you.

@TETRA2000 TETRA2000 changed the title Allow installation in the outer .git directory Allow to installation in the outer .git directory Feb 27, 2018
@TETRA2000 TETRA2000 changed the title Allow to installation in the outer .git directory Allow installation in the outer .git directory Feb 27, 2018
@typicode
Copy link
Owner

Hi @TETRA2000,

Thank you for the PR, have you seen https://github.com/typicode/husky/blob/dev/docs.md#sub-directory-package?
Would that work for you?

@TETRA2000
Copy link
Author

@typicode Thank you for replying.
It worked for me. But I don't want to add package.json in root directory in this case.
Because root directory contains files which only used by back-end application except frontend directory.
And I'm thinking to trigger front-end related tasks(npm run lint and so on) by git hook.

Also I know this kind of specification may cause unintended behavior.
So, could you give me your opinion?

Thank you.

@malixsys
Copy link

@typicode @TETRA2000
You should use git rev-parse --show-toplevel from a child process to find where the git root is...

@typicode typicode closed this Oct 1, 2018
@typicode
Copy link
Owner

typicode commented Oct 1, 2018

Fixed by 1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants