ds300 / ds300/postinstall-postinstall
Running the postinstall hook twice is surprising and unexpected, especially with suppressed output
- Dominant language
- JavaScript
- Stars
- 56
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
As noted in the README, this package runs the postinstall hook twice when yarn is run on your project.
The first time it is run, apparently standard out and standard in are swallowed. This is no doubt done to prevent confusion on the part of users of `patch-package`, so they don't see reports of their patches being run twice.
However, I needed to add another script to my postinstall hook cause I needed to do patching in a different way than `patch-package` does. My script happened to be idempotent, but I spent hours tearing my hair out because it was reporting that my patch had already been applied. How could the script be getting run twice? But it couldn't be getting run twice because if it were, it would be reporting both runs on the console, WOULDN'T IT???????
Finally I got to the README in this package. I had read the README of `patch-package`, but hadn't bothered coming here.
I suggest that, if a better way cannot be found to convince yarn to run the postinstall hook on `yarn remove`, that a note warning of this behavior should be added to the [Why use postinstall-postinstall](https://github.com/chetstone/patch-package#why-use-postinstall-postinstall-with-yarn) section of the `patch-package` README.
Also, add a note to the fact that standard out and standard error are suppressed to this README.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.