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

When used in a dependency, the hooks installed into the parent package #82

Open
jfparadis-appomni opened this issue Nov 3, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@jfparadis-appomni
Copy link

I came across a package that was updating its git hooks with a post install script:

 "postinstall": "npx simple-git-hooks",

When that package was installed as a dependency of another package, it installed the hooks in the parent package.

@toplenboren
Copy link
Owner

Hi, thanks for the report. Gonna try to catch and fix this in spare time

@toplenboren toplenboren added the bug Something isn't working label Nov 11, 2022
@zhou-tao
Copy link

same problem. can resolved it now?

@toplenboren
Copy link
Owner

toplenboren commented Mar 3, 2024

Okay, there are two problems here:


If you do not use simple-git-hooks you are going to get something like this:

npm ERR! code 127
npm ERR! path /home/.../workspace/test/node_modules/json-editor-vue
npm ERR! command failed
npm ERR! command sh -c simple-git-hooks
npm ERR! sh: line 1: simple-git-hooks: command not found

Taken from cloydlau/json-editor-vue#73

I will not be able to fix this, since simple-git-hooks is not even executed here :(


If you have simple-git-hooks then this package will trigger install of the hooks. Will add an additional check for that case

l generally advise agains calling simple-git-hooks as a postinstall script in your own package. It should be removed upon publishing to npm.

Added a note about that in `README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants