From ac8159ce1d25cb014f2334ebd0fb3966db16b0e9 Mon Sep 17 00:00:00 2001 From: baldo Date: Fri, 26 Aug 2022 16:16:26 +0200 Subject: [PATCH] Add pre-commit hook that runs all the checks. --- git-hooks/pre-commit | 21 +++++++++++++++++++++ package.json | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 git-hooks/pre-commit diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit new file mode 100755 index 0000000..a2f4452 --- /dev/null +++ b/git-hooks/pre-commit @@ -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 diff --git a/package.json b/package.json index 348a5de..7f37a8c 100644 --- a/package.json +++ b/package.json @@ -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/",