Add pre-commit hook that runs all the checks.

This commit is contained in:
baldo 2022-08-26 16:16:26 +02:00
parent f0dcb63418
commit ac8159ce1d
2 changed files with 24 additions and 1 deletions

21
git-hooks/pre-commit Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e
cd "$(dirname "${BASH_SOURCE[0]}")/../.."
export PATH="$PWD/nix:$PATH"
for directory in . ./frontend; do
if [[ -d "$directory" ]]; then
echo
echo "==================================================="
echo "Checking: $PWD"
echo "==================================================="
echo
pushd "$directory"
yarn run check
popd
fi
done

View file

@ -19,10 +19,12 @@
"ffffng": "server/main.js" "ffffng": "server/main.js"
}, },
"scripts": { "scripts": {
"check": "yarn run build && yarn run lint && yarn run test",
"test": "yarn run server:test", "test": "yarn run server:test",
"lint": "yarn run server:lint",
"build": "yarn run server:build && grunt build && rsync -avzL --exclude='*/__mocks__/' --exclude='*.test.*' server-build/ dist/server/", "build": "yarn run server:build && grunt build && rsync -avzL --exclude='*/__mocks__/' --exclude='*.test.*' server-build/ dist/server/",
"clean": "rm -rf server-build/ dist/ && grunt clean", "clean": "rm -rf server-build/ dist/ && grunt clean",
"dist": "yarn run clean && yarn run build && yarn run server:lint && ./bin/dist-fix-symlinks.sh && yarn run test", "dist": "yarn run clean && yarn run build && yarn run check && ./bin/dist-fix-symlinks.sh",
"client:serve": "grunt serve", "client:serve": "grunt serve",
"server:test": "jest --config=jest.server.config.js", "server:test": "jest --config=jest.server.config.js",
"server:build": "tsc -b server && ln -sfv ../../server/db/patches ./server-build/db/ && ln -sfv ../server/templates ./server-build/ && ln -sfv ../server/mailTemplates ./server-build/", "server:build": "tsc -b server && ln -sfv ../../server/db/patches ./server-build/db/ && ln -sfv ../server/templates ./server-build/ && ln -sfv ../server/mailTemplates ./server-build/",