Skip to content

[REFERENCE] Install and config automate tasks in Angular project

Anartz Mugika Ledo edited this page May 14, 2022 · 3 revisions

The goal is to be able to install and configure everything necessary to automate tasks with the aim of maintaining the quality of the code that we are going to implement in the project together with the application of good practices using git flow.

.husky/pre-commit
-------------------

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint

Add chmod a+x .husky/pre-commit

Now, we have install and config commitlint

Go to: https://commitlint.js.org/#/guides-local-setup

Execute this command

yarn add -D @commitlint/{cli,config-conventional}

Configure commitlint to use conventional config echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js

Add commit-msg hook in Husky

.husky/commit-msg
-------------------
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"

Add chmod a+x .husky/commit-msg

Use this reference to add correct commits follow Git Conventional Commits Styleguide: https://www.conventionalcommits.org/en/v1.0.0/

Clone this wiki locally