带有哈士奇的自定义 cra 模板不会触发 githooks

问题描述

刚刚用自定义 cra 模板撞到了一块石头,希望有人能提供帮助。

我在 official base cra-template 中添加了 huskylint-stagedprettier。问题是除非我重新添加哈士奇,否则不会触发 pre-commit 钩子。

使用 diff 进行故障排除时,我注意到 .git/hooks 进程没有在 create-react-app 目录中创建任何 githooks 文件。只有在我重新添加 husky 时才会创建这些文件。

git clone https://github.com/piouson/cra-template-husky-test.git
npx create-react-app test-app --template file:./cra-template-husky-test
ls test-app/.git/hooks # notice only sample files present

所以我想我的问题是如何解决这个问题,所以 githooks 文件是由 create-react-app 进程创建的?

环境: wsl2 Ubuntu 20.04.2 LTS | git v2.25.1 | node v10.23.0 | npm v7.5.6 | yarn v1.22.10

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)