diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..f15e058 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,5 @@ +#!/bin/sh +set -eu + +printf 'Running pre-commit checks...\n' +bun run check diff --git a/README.md b/README.md index e6c2b05..8f6a7b2 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Lively Forms is a conversational form builder inspired by Typeform. It lets crea ```bash bun install +bun run hooks:install cp .env.example .env bun run db:up bun run prisma:migrate @@ -52,6 +53,8 @@ You must also configure Google OAuth for local development. See [docs/deployment bun run dev bun run build bun run lint +bun run check +bun run hooks:install bun run db:up bun run db:down bun run db:logs diff --git a/docs/development.md b/docs/development.md index 4f120c5..5e7219a 100644 --- a/docs/development.md +++ b/docs/development.md @@ -13,6 +13,7 @@ This document covers day-to-day local development for Lively Forms. ```bash bun install +bun run hooks:install cp .env.example .env bun run db:up bun run prisma:migrate @@ -77,20 +78,33 @@ bun run prisma:studio ## Quality checks -Run lint: +Run the full local verification suite used by CI: + +```bash +bun run check +``` + +Run lint only: ```bash bun run lint ``` -Run a production build: +Run a production build only: ```bash bun run build ``` +Install git hooks for this repo: + +```bash +bun run hooks:install +``` + Notes: +- The pre-commit hook runs `bun run check`, which includes formatting, linting, type-checking, and a production build. - `bun run build` also validates translation resources before the Next.js build. - There is currently no separate test suite command in `package.json`. diff --git a/package.json b/package.json index 5cf60f5..edaf08e 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "format": "prettier --write .", "format:check": "prettier --check . --ignore-unknown", "check": "bun run format:check && bun run lint && bun run typecheck && bun run build", + "hooks:install": "git config core.hooksPath .githooks", "db:up": "podman-compose up -d", "db:down": "podman-compose down", "db:logs": "podman-compose logs -f postgres",