-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b043cea
commit e7a55fc
Showing
28 changed files
with
270 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run lint-commit-msg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,36 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
# Get the current Git branch name | ||
BRANCH_NAME=$(git symbolic-ref --short HEAD) | ||
|
||
# Forbid direct commits to master or develop | ||
if [ "$BRANCH_NAME" = "master" ] || [ "$BRANCH_NAME" = "develop" ]; then | ||
echo "Commits to $BRANCH_NAME branch are forbidden." | ||
exit 1 | ||
fi | ||
|
||
# Lint the staged files | ||
npx lint-staged | ||
TYPE_CHECK=no | ||
|
||
PARSE_OPENAPI=no | ||
|
||
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM) | ||
|
||
for file in $STAGED_FILES; do | ||
case "$file" in | ||
*.cjs|*.js|*.jsx|*.mjs|*.ts|*.tsx) | ||
TYPE_CHECK=yes | ||
;; | ||
esac | ||
|
||
case "$file" in | ||
*.yaml) | ||
PARSE_OPENAPI=yes | ||
;; | ||
esac | ||
done | ||
|
||
if [ "$TYPE_CHECK" = "yes" ]; then | ||
npm run type-check | ||
fi | ||
|
||
if [ "$PARSE_OPENAPI" = "yes" ]; then | ||
npm run parse-openapi | ||
fi | ||
|
||
npm run lint-staged-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.