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

Cannot use pre-git when node_modules is not in the same folder as .git folder #101

Open
pascalvaccaro opened this issue Dec 7, 2016 · 4 comments

Comments

@pascalvaccaro
Copy link

This is quite annoying: I have a project where the repo contains java back-end sources and the front-end sources in a separate folder, like so:

.
|____.git
|____project-backend
|____project-scripts
|____project-ui
| |____node_modules
| |____package.json
|____project-webapp

Is there any way to tell pre-git to look for package.json in a specific folder? If not can we add this feature? I'm up for it :-)

@bahmutov
Copy link
Owner

bahmutov commented Dec 7, 2016 via email

@pascalvaccaro
Copy link
Author

We have to assume the user pwd can be anywhere from the deepest to the root folder of his git repository. Once we find the root (cd.. until pwdis equal to GIT_ROOT), we scan every sub-folder in the root folder for a file named 'package.json', cd to that folder and run the hook commands.
Does this solution make sense?

You may even find situations where several sub-folders contain a package.json, each with different commands associated to their git-hooks. It might be complicated though not impossible, in my opinion, to run individual scripts for each of them (but this is another subject).

@bahmutov
Copy link
Owner

bahmutov commented Dec 7, 2016

sure, so breadth first search for package.json with pre-git configured. Works for me if you want to implement and send a merge request

@elawad
Copy link

elawad commented Jun 6, 2017

Here's an idea used by another git-hook package.
https://github.com/okonet/lint-staged#working-from-a-subdirectory

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

No branches or pull requests

3 participants