diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 00000000..31354ec1 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 00000000..59ef2768 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install vant-cli commit-lint $1 diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..d37daa07 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install lint-staged diff --git a/package.json b/package.json index 1ca7107e..88cc8221 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "scripts": { "dev": "node build/dev.js", "lint": "eslint ./packages --ext .js,.ts --fix && stylelint \"packages/**/*.less\" --fix", + "prepare": "husky install", "release": "sh build/release.sh", "release:site": "sh build/release-site.sh", "build:lib": "yarn && npx gulp -f build/compiler.js --series buildEs buildLib", @@ -25,12 +26,6 @@ "type": "git", "url": "git+ssh://git@github.com/youzan/vant-weapp.git" }, - "husky": { - "hooks": { - "pre-commit": "lint-staged", - "commit-msg": "vant-cli commit-lint" - } - }, "lint-staged": { "*.{ts,js}": [ "eslint --fix",