Add pre-commit hook that runs all the checks.

This commit is contained in:
baldo 2022-08-26 16:16:26 +02:00
parent 8cf692b523
commit 53bb20781d
3 changed files with 26 additions and 1 deletions

View file

@ -8,9 +8,11 @@
"email": "andreas@baldeau.net"
},
"scripts": {
"check": "yarn run typecheck && yarn run lint",
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview --port 5050",
"test": "yarn run test:unit",
"test:unit": "vitest --environment jsdom",
"typecheck": "vue-tsc --noEmit",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"

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"
},
"scripts": {
"check": "yarn run build && yarn run lint && yarn run 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/",
"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",
"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/",