Avoid `prexxx` `postxxx` names for hooks
See original GitHub issueWhen you run your npm script called xxx, npm will automatically execute the scripts prexxx before and postxxx after the target script if available. husky uses the names with pre and post for the hook scripts a lot , this introduces the limitation for the names of your npm scripts, e.g. https://github.com/typicode/husky/issues/94#issuecomment-279703998
Can we use names like pre-xxx and post-xxx for the hooks instead?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:7 (2 by maintainers)
Top Results From Across the Web
The How To Of HBase Coprocessors - 3Pillar Global
Region Server Observer: Provides hook for the events related to the RegionServer, such as stopping the RegionServer and performing ...
Read more >LOINC Users' Guide Version 2.67 (Published December 2019)
Logical Observation Identifiers Names and Codes (LOINC®). Users' Guide ... 2.1.2.19 Avoid use of the word “total” in laboratory test names, ...
Read more >npm命令及npm scripts的简单总结- 前端小丑- 博客园
pre 和post hooks. 双重的pre和post无效,比如prepretest和postposttest是无效的。 { "scripts":{ 'prexxx':, 'xxx':, 'postxxx':, } }.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found
I’m not sure if that will fully resolve the issue. There is nothing stopping it for whatever reason executing
prepre-commitfor example. Also, it takes away the ability to name certain scripts becausegithas a commit hook for that. One of the ones I see isupdate. Also, what ifgitdecides to add a new hook in the future? So currently I have a script calledfoo, I upgradegitand now it has a hook calledfooas well. All of a sudden, my script will automatically run when it shouldn’t. Personally, I like the idea of the hooks being in there separate configuration much like howghookshad it (that was one of the main reason why I switched fromhuskytoghooks). While the maintainer have essentially given up and recommend people to using this, I still find the git hooks being in the scripts block rather dangerous. I do want to make this work though so my recommendation is this: Add support for users of this module to specify where they want the hooks to be read from via a configuration in package.json. It can continue to support what it is currently doing as the default. Otherwise, users of the configure it to be in a separate config such as:@typicode It is definitely possible to rename your scripts to avoid the clashes, but I believe it’s still a limitation. In our project the script that caused the problem was
commit. We use commitizen for maintaining the format of our commit messages and the script looks like:"commit": "git-cz". We renamed that toczeventually, but the namecommitmakes more sense to me still.