tarmolov / git-hooks-js

A tool to manage and run project git hooks
167 stars 30 forks source link

Use relative path to git-hooks in installed hooks scripts #62

Closed pjohnmeyer closed 4 years ago

pjohnmeyer commented 5 years ago

Before this patch, installing git-hooks would use absolute paths to require node_modules/git-hooks/lib/git-hooks. This works most of the time, but there are instances in which it does not. For example:

I do development on a host machine, but yarn install runs inside a Docker container. In this case, the absolute path to node_modules is different in the two environments. This means for the git-hooks module to work as intended, I am only able to run Git commands from inside of the container. I typically run Git commands from the host machine, so this doesn't work for me.

More importantly, though, I see no reason to force everybody working on my project to use Git in one environment or the other.

After this patch, installed git-hooks use relative paths to require node_modules/git-hooks/lib/git-hooks.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.01%) to 98.958% when pulling d4ad93747002b0fc565daeedd0a3a4a4ac911368 on pjohnmeyer:use-relative-paths-in-hooks into f7e9bd5b00a0b79b831b5383ba88e9446eb1cd82 on tarmolov:master.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.01%) to 98.958% when pulling d4ad93747002b0fc565daeedd0a3a4a4ac911368 on pjohnmeyer:use-relative-paths-in-hooks into f7e9bd5b00a0b79b831b5383ba88e9446eb1cd82 on tarmolov:master.

pjohnmeyer commented 5 years ago

I did not add any tests because it seemed to me this was covered by existing tests. I am happy to add some if you think there is something needed.

pjohnmeyer commented 4 years ago

@tarmolov I am closing this PR due to inactivity, to get it out of my PR dashboard. Feel free to reopen if you intend to merge it.