git-husky

How to run husky pre-commit in child directory only

余生颓废 提交于 2021-01-22 06:37:08
问题 We have an enterprise application with a folder structure like the following: /project .git /sub1 ...Java project /sub2 package.json ...Javascript Backbone project /sub3 ...Java project /sub4 ...Java project /sub5 package.json ...Javascript React project I currently have Husky set up both in sub2 and sub5 projects, which causes conflicts (requires an npm install whenever I switch projects). Also, the Java developers are reporting that when they commit code in projects sub1, sub3 and sub4, the

How to run husky pre-commit in child directory only

南楼画角 提交于 2021-01-22 06:35:37
问题 We have an enterprise application with a folder structure like the following: /project .git /sub1 ...Java project /sub2 package.json ...Javascript Backbone project /sub3 ...Java project /sub4 ...Java project /sub5 package.json ...Javascript React project I currently have Husky set up both in sub2 and sub5 projects, which causes conflicts (requires an npm install whenever I switch projects). Also, the Java developers are reporting that when they commit code in projects sub1, sub3 and sub4, the

Pylint with pre-commit and EsLlint with husky

你离开我真会死。 提交于 2020-12-26 19:56:52
问题 I have a project with a frontend in JS and backend in Python. Frontend had been configured with husky pre-commit hook. Today I've configured Pylint with pre-commit library but husky hooks had been overwritten by that move. Is it possible to combine pre-commit and husky libraries? If not... what's the best way to solve the problem? 回答1: pre-commit has a "migration mode" for running other existing hook frameworks. It seems that husky is slightly too clever in their hook implementation for

GIT (HUSKY): exit code when a file is being committed?

假装没事ソ 提交于 2020-01-03 05:07:09
问题 is there a way to check if a file is being committed and exit with an error ? I have a file in git that needs to be there but should never be modified and i was hoping to use husky as a pre-commit - so if anybody tries to modify the file and commit then it would throw an error. If in future I need to modify the file then i can just disable the pre-commit. the file is a configuration that i need to edit a lot when developing but the changes should never be committed. I was hoping to use husky

Custom git hook in package.json with husky

こ雲淡風輕ζ 提交于 2019-12-13 03:41:50
问题 I am trying to validate the commit message at commit. For that, I am using Husky and the commit-msg hook. However, as I also do commit message validation at build time, I want the validation code to be available in a separate JS file. So I am trying to call an external JS file to perform my commit validation. In my package.json file, I have: "commitmsg": "node validation.js" However, I cannot get the validation to be performed properly. Right now, validation.js looks like this: console.log(

Git add in pre-commit hook not staging file for commit

限于喜欢 提交于 2019-12-10 11:35:54
问题 I have written a pre-commit hook that compiles my project and adds the generated file to the commit. This is a JavaScript project and I am using husky, but I have experimented with editing the .git/hooks/pre-commit as well and the file is not getting added to the commit. If I cancel the commit, I can see the file has been added, but for some reason this is not applying to the current commit. My pre-commit hook looks something like: const shell = require('shelljs'); shell.exec('yarn bundle');