generated from leaflet-maps-course/leaflet-angular-basic
-
Notifications
You must be signed in to change notification settings - Fork 3
[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.
- Install Angular ESLint with Schematics: Github
- Install Husky to execute hooks to make differents actions: Documentation
- Check if exist .husky directory inside Git Hooks: https://typicode.github.io/husky/#/?id=hooks-not-running
.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/