diff --git a/.husky/common.sh b/.husky/common.sh new file mode 100644 index 00000000..0f4ced82 --- /dev/null +++ b/.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 \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..23b7afcb --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,3 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" +. "$(dirname "$0")/common.sh" diff --git a/package.json b/package.json index 0d471f19..99a7f8ad 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-vue": "^7.17.0", + "husky": "^7.0.2", "prettier": "^2.3.2", "vditor": "^3.8.6", "vue": "^3.2.6", diff --git a/yarn.lock b/yarn.lock index 43ad35c8..e8ee8f05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1230,6 +1230,11 @@ htmlparser2@^6.1.0: domutils "^2.5.2" entities "^2.0.0" +husky@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/husky/-/husky-7.0.2.tgz#21900da0f30199acca43a46c043c4ad84ae88dff" + integrity sha512-8yKEWNX4z2YsofXAMT7KvA1g8p+GxtB1ffV8XtpAEGuXNAbCV5wdNKH+qTpw8SM9fh4aMPDR+yQuKfgnreyZlg== + icss-replace-symbols@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded"