From f2a22fa22fc350aeb1200acc455dada2e183a9e7 Mon Sep 17 00:00:00 2001 From: Thamognya Kodi Date: Sun, 1 Jan 2023 23:36:00 +0700 Subject: [PATCH] update: look at todo --- web/frontend/.husky/commit-msg | 5 +++++ web/frontend/.husky/common.sh | 8 ++++++++ web/frontend/.husky/pre-commit | 5 +++++ web/frontend/package.json | 2 +- 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 web/frontend/.husky/commit-msg create mode 100644 web/frontend/.husky/common.sh create mode 100644 web/frontend/.husky/pre-commit diff --git a/web/frontend/.husky/commit-msg b/web/frontend/.husky/commit-msg new file mode 100644 index 0000000..29d991c --- /dev/null +++ b/web/frontend/.husky/commit-msg @@ -0,0 +1,5 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" +. "$(dirname "$0")/common.sh" + +yarn commitlint --edit $1 diff --git a/web/frontend/.husky/common.sh b/web/frontend/.husky/common.sh new file mode 100644 index 0000000..7bf8076 --- /dev/null +++ b/web/frontend/.husky/common.sh @@ -0,0 +1,8 @@ +command_exists () { + command -v "$1" >/dev/null 2>&1 +} + +# Workaround for Windows 10, Git Bash and Yarn +if command_exists winpty && test -t 1; then + exec < /dev/tty +fi diff --git a/web/frontend/.husky/pre-commit b/web/frontend/.husky/pre-commit new file mode 100644 index 0000000..eb6e8c1 --- /dev/null +++ b/web/frontend/.husky/pre-commit @@ -0,0 +1,5 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" +. "$(dirname "$0")/common.sh" + +yarn lint-staged diff --git a/web/frontend/package.json b/web/frontend/package.json index e249e6d..07c1c77 100644 --- a/web/frontend/package.json +++ b/web/frontend/package.json @@ -12,7 +12,7 @@ "lint:prettier": "prettier --check .", "lint": "yarn lint:js && yarn lint:style && yarn lint:prettier", "lintfix": "prettier --write --list-different . && yarn lint:js --fix && yarn lint:style --fix", - "prepare": "", + "prepare": "husky install", "test": "jest" }, "lint-staged": {