Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.

Commit

Permalink
chore: Проверка типов в pre-commit
Browse files Browse the repository at this point in the history
Вместо проверки типов по всему проекту в `pre-push` теперь выполняется проверка в `pre-commit` и только в staged `.ts` и `.vue` файлах
  • Loading branch information
cawa-93 committed Jun 2, 2021
1 parent 53b42cb commit 10fc7a6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
"Chrome 91"
],
"simple-git-hooks": {
"pre-commit": "npx lint-staged",
"pre-push": "npm run typecheck"
"pre-commit": "./scripts/tsc-staged.sh && npx lint-staged"
},
"lint-staged": {
"*.{js,ts,vue}": "eslint --cache --fix"
Expand Down
26 changes: 26 additions & 0 deletions scripts/tsc-staged.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

staged=$(git diff --name-only --cached | grep -E "(tsconfig.json|.ts|.vue)$")

args=()

if [[ "$staged" == *"packages/main"* ]]; then
args=("${args[@]}" "npm:typecheck:main")
fi

if [[ "$staged" == *"packages/preload"* ]]; then
args=("${args[@]}" "npm:typecheck:preload")

fi

if [[ "$staged" == *"packages/renderer"* ]]; then
args=("${args[@]}" "npm:typecheck:renderer")
fi

# shellcheck disable=SC2128
if [ -z "$args" ]; then
echo "No type sensitivity files staged"
else
node scripts/buildEnvTypes.js
npx concurrently --raw "${args[@]}"
fi

0 comments on commit 10fc7a6

Please sign in to comment.