From b5ab4417655784ba3cc25eddf0a061cc86b1dfc0 Mon Sep 17 00:00:00 2001 From: toririm Date: Sun, 2 Feb 2025 00:26:44 +0900 Subject: [PATCH] feat: Add git hooks by husky --- .husky/pre-commit | 4 ++++ README.md | 5 +++++ package.json | 4 +++- pnpm-lock.yaml | 10 ++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..deb6975 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +pnpm fmt diff --git a/README.md b/README.md index f5d89c2..28d33e9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # cafeore +## Get Started + +1. Run `pnpm i` to install dependencies. +2. Run `pnpm setup` to setup git hooks. (First time only) + ## Commands |command|description| |--|--| diff --git a/package.json b/package.json index 74e5aae..6502c1a 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.0", "packageManager": "pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0", "scripts": { + "setup": "pnpm exec husky init", "lint": "biome check", "fmt": "biome check --write", "common": "pnpm -F \"common\"", @@ -10,6 +11,7 @@ "mobile": "pnpm -F \"mobile\"" }, "devDependencies": { - "@biomejs/biome": "1.9.4" + "@biomejs/biome": "1.9.4", + "husky": "^8.0.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7e02b9f..9249e49 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@biomejs/biome': specifier: 1.9.4 version: 1.9.4 + husky: + specifier: ^8.0.0 + version: 8.0.3 modules/common: dependencies: @@ -3488,6 +3491,11 @@ packages: resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} engines: {node: '>=10.17.0'} + husky@8.0.3: + resolution: {integrity: sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==} + engines: {node: '>=14'} + hasBin: true + iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} @@ -9425,6 +9433,8 @@ snapshots: human-signals@2.1.0: {} + husky@8.0.3: {} + iconv-lite@0.4.24: dependencies: safer-buffer: 2.1.2