Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧩 Feature: Document husky usage on main README #39

Closed
iamkacperwasik opened this issue Feb 10, 2021 · 6 comments
Closed

🧩 Feature: Document husky usage on main README #39

iamkacperwasik opened this issue Feb 10, 2021 · 6 comments
Assignees
Labels
priority: low type: documentation Improvements or additions to documentation

Comments

@iamkacperwasik
Copy link
Contributor

Describe the solution you'd like

  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
      "prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"
    }
  },
@KL13NT
Copy link
Owner

KL13NT commented Feb 10, 2021

It already runs a pre-commit hook on my machine, doesn't it on yours?

@KL13NT
Copy link
Owner

KL13NT commented Feb 10, 2021

The configuration is setup in package.json to lint commit messages before they're admitted, and if the linting process returns errors it'll stop the whole commit. ESLint, Prettier, and Jest are set to run on precommit as well.

@iamkacperwasik
Copy link
Contributor Author

"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"

runs commitizen on git commit like you were to type yarn commit

@KL13NT KL13NT changed the title 🧩 Feature: make husky run on git commit 🧩 Feature: Configure husky prepare-commit-msg hook Feb 10, 2021
@KL13NT
Copy link
Owner

KL13NT commented Feb 10, 2021

The || true part provides undefined behavior on Windows. There's an open issue about it.

And I just remembered that in the committing section of the contribution guide it's mentioned that this is left out by choice.

If you know what the Angular commit format is and have used it before alongside standard-version then by all means feel free to commit as you usually do after running npm run precommit. Note though that your commit messages will be checked by husky to make sure they're compliant either way.

I don't wish to go through the CLI slow process every time, provided I already know the correct format, etc. Husky will run after I commit normally, and that should be enough delay for an advanced user. Do you think this should be documented in the repo's README?

@KL13NT KL13NT added environment: linux environment: windows priority: low type: chore Things that are not enhancements, docs, nor bugs type: documentation Improvements or additions to documentation and removed type: chore Things that are not enhancements, docs, nor bugs labels Feb 10, 2021
@iamkacperwasik
Copy link
Contributor Author

I think we should mention this, because for someone it can be difficult at the beggining to use the convention, especially remember to type yarn commit, but I can agree that this approach isn't the best for people who already knows it and don't have to mess around with it.

@KL13NT KL13NT self-assigned this Feb 10, 2021
@KL13NT KL13NT changed the title 🧩 Feature: Configure husky prepare-commit-msg hook 🧩 Feature: Document husky usage on main README Feb 10, 2021
@KL13NT
Copy link
Owner

KL13NT commented Feb 10, 2021

Done in 005e044.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low type: documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants