Skip to content

Commit 748a343

Browse files
authored
Merge pull request #55 from hemicharly/feature/add-husky
Feature: Merge feature/add-husky into Develop
2 parents 77860fd + 3f58d91 commit 748a343

File tree

7 files changed

+72
-3
lines changed

7 files changed

+72
-3
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Description
2+
<!-- Briefly explain what was done in this PR. -->
3+
4+
## Change Type
5+
- [ ] New Feature
6+
- [ ] Bug Fix
7+
- [ ] Refactoring
8+
- [ ] Documentation
9+
- [ ] Maintenance Task
10+
11+
## Checklist
12+
- [ ] Code follows defined style standards.
13+
- [ ] New or updated tests added.
14+
- [ ] Test coverage remains acceptable.
15+
- [ ] Documentation has been updated, if applicable.
16+
17+
## Related to
18+
<!-- Reference issues or other PRs. -->

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.idea
22

3+
/node_modules
4+
35
/app/dist
46
/app/build
57
/app/node_modules

.husky/pre-commit

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
echo "Running pre-commit..."
5+
6+
# shellcheck disable=SC2164
7+
cd app
8+
9+
echo "Running lint fix..."
10+
npm run lint:fix
11+
12+
echo "Running format fix..."
13+
npm run format:fix
14+
15+
# shellcheck disable=SC2103
16+
cd ..
17+
18+
if [ -n "$(git status --porcelain)" ]; then
19+
echo "Changes detected after formatting, adding to commit"
20+
git add .
21+
echo "Changes added to the commit"
22+
else
23+
echo "No changes to add"
24+
fi

.husky/pre-push

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
4+
5+
if echo "$BRANCH_NAME" | grep -qE '^(feature|bugfix|release|hotfix)\/[a-z0-9-]+$'; then
6+
echo "Valid branch name: $BRANCH_NAME"
7+
else
8+
echo "🚫 The branch name '$BRANCH_NAME' does not follow the Gitflow standard."
9+
echo "Valid example: feature/new-functionality"
10+
exit 1
11+
fi

app/src/modules/web/shared/middleware/exceptions/filters/http-exception.filter.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ export class HttpExceptionFilter implements ExceptionFilter {
1111
const response = ctx.getResponse<Response>();
1212

1313
if (exception instanceof CustomBaseException) {
14-
response.status(exception.statusCode).json({
15-
errors: exception.errors,
16-
});
14+
response.status(exception.statusCode).json({ errors: exception.errors });
1715
return;
1816
}
1917

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"scripts": {
3+
"prepare": "husky"
4+
},
5+
"dependencies": {
6+
"husky": "^9.1.7"
7+
}
8+
}

yarn.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
5+
husky@^9.1.7:
6+
version "9.1.7"
7+
resolved "https://registry.yarnpkg.com/husky/-/husky-9.1.7.tgz#d46a38035d101b46a70456a850ff4201344c0b2d"
8+
integrity sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==

0 commit comments

Comments
 (0)