Skip to content

Instantly share code, notes, and snippets.

@WeslyG
Created April 5, 2022 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WeslyG/1e7c2c753f369e5294acf7e25b2073d2 to your computer and use it in GitHub Desktop.
Save WeslyG/1e7c2c753f369e5294acf7e25b2073d2 to your computer and use it in GitHub Desktop.
powershell pre-commit hook with sh
#!/bin/sh
tscCommand="powershell.exe yarn tsc"
lintCommand="powershell.exe yarn lint"
echo "[HOOK] Running tsc..."
q=$(exec $tscCommand)
result=$?
if [ "$result" != "0" ]
then
echo "==================="
echo "| |"
echo "[HOOK] TSC failed!"
echo "| |"
echo "==================="
exit 1
fi
echo "[HOOK] Running lint..."
z=$(exec $lintCommand)
result2=$?
if [ "$result2" != "0" ]
then
echo "==================="
echo "| |"
echo "[HOOK] lint failed!"
echo "| |"
echo "==================="
exit 1
fi
echo "====================================="
echo "= ="
echo "= [HOOK] All linter passed success! ="
echo "= ="
echo "====================================="
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment