Closed RedGoldPhoenix closed 3 months ago
Hi,
You need two files.
.husky/pre-commit
python .husky/pre-commit.py
.husky/pre-commit.py
# Your Python code
# ...
@typicode I added a PR to add documentation for this. It was something that I had to fix when migrating from v8 to v9
@typicode @gcko
Good Moning I did the test and that worked with the pre-commit. I put an other one like the commit-msg and I did the same bad behaviour and that stop working.. I know that is strange .. I believe I will uninstall and reinstall the tool and test again
Thanks for your support and you help
Hello I did it I have suppressed Husky and I have installed it again
Uninstall ok
Install as you explain in the documentation
I launched a commit to run the pre-commit hook you give with the installation
I copy the commit-msg from the folder '_' to .kusky and I've updated the pre-commit and commit message as below
As t ypi can see bemow when I launch the commit the commit-msg don't run as expected
In Window I don't have to do a chmod -x correct ? For me I don't have to do it bit I prefer to ask Best Regards
Hello I have a question What I must do to install and stay on the version 8.0.3 and be sure that the developers after a npm install will install the same version
npm i husky@8 -D
, revert hooks and prepare script. Run prepare once on your machine and have other developers run npm install
on theirs.
@typicode Thanks a lot for your solution I'm happy to find again the same behavior I have previously Do you believe that with the next version, you can reintroduce some feature as we had with the version V8 ?
1- I have uninstall the version V9 with npm uninstall husky
2- suppressed the .husky folder
3- I've launched the commands below in this order
npm i husky@8 -D
npm install husky --save-dev
npm pkg set scripts.prepare="husky install"
npx husky install
echo 'node_modules' >> .gitignore
cat .git/config
(to check that the hooksPath=.husky)
npx husky add .husky/pre-commit "echo ‘Test pre-commit hook’"
npx husky add .husky/commit-msg "echo ‘Test commit-msg hook’"
git add .
git commit -m'Update Husky V8'
At the end I have copied and pasted my hook in Python and everything work fine
Congrats! :+1:
Do you believe that with the next version, you can reintroduce some feature as we had with the version V8 ?
It's a bit early to say. As for the commit-msg
not working I just realized that your script was probably expecting a parameter. My bad, sorry.
It should have been python .husky/commit-msg.py "$1"
@typicode Thanks for your last message I will test it and will give you a return ;) Thanks again for your support.
Hello,
I am currently using Visual Studio Code version 1.85.1, NodeJs version 20, and Husky version 9.
I've been using Husky since December, starting with the previous version, and my initial experience was excellent. I had no issues running the hooks coded in Python, and I easily shared them with other developers who executed the "npm install" command without any problems. The hooks I previously managed in the .git/hooks/ folder worked seamlessly in the .husky/ folder.
However, after installing the latest Husky version like below :
npm install --save-dev husky
and then:
npx husky init
I encountered a behavior change, and I received the following error message:
I have read the tutorial at https://typicode.github.io/husky/how-to.html and found a relevant chapter: "Understanding PATH and Version Managers." According to my understanding, I need to create a folder in my repository, .config/husky/, and then create the file init.sh in it.
In the init.sh file, I added the line ~/python since Python on my laptop is installed in C:\Program File\python. Is this correct, or did I make a mistake? For your information, I followed these steps, but the issue persists.
I would greatly appreciate your assistance in resolving this problem, as I am currently stuck on this matter.
Best regards,