Skip to content

Commit

Permalink
feat: added husky lib for checking commits and branches (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
amihajlovski authored Nov 3, 2023
1 parent 89717e8 commit d4c4b74
Show file tree
Hide file tree
Showing 6 changed files with 991 additions and 23,694 deletions.
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run check-branch-name
npm run lint
13 changes: 13 additions & 0 deletions branching.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
local_branch_name="$(git rev-parse --abbrev-ref HEAD)"

valid_branch_regex='^(feature|bugfix|improvement|library|prerelease|release|hotfix)\/.'

message="There is something wrong with your branch name. Branch names in this project must start with feature|bugfix|improvement|library|prerelease|release|hotfix followed by /. Example: feature/name-of-the-feature."

if [[ ! $local_branch_name =~ $valid_branch_regex ]]; then
echo "$message"
exit 1
fi

exit 0
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional']
}
Loading

0 comments on commit d4c4b74

Please sign in to comment.