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..d50cdcf9 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,7 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +# Export Git hook params +export GIT_PARAMS=$* + +npx --no-install fabric verify-commit 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 86251d67..6a1890a7 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "lint:style": "stylelint --fix \"src/**/*.less\" --syntax less", "openapi": "umi openapi", "playwright": "playwright install && playwright test", - "precommit": "lint-staged", "prettier": "prettier -c --write \"src/**/*\"", "serve": "umi-serve", "start": "cross-env UMI_ENV=dev umi dev", @@ -39,7 +38,8 @@ "test": "umi test", "test:component": "umi test ./src/components", "test:e2e": "node ./tests/run-tests.js", - "tsc": "tsc --noEmit" + "tsc": "tsc --noEmit", + "prepare": "husky install" }, "lint-staged": { "**/*.less": "stylelint --syntax less", @@ -92,12 +92,12 @@ "@umijs/preset-ant-design-pro": "^1.3.0", "@umijs/preset-dumi": "^1.1.0", "@umijs/preset-react": "^1.8.17", - "@umijs/yorkie": "^2.0.5", "cross-env": "^7.0.0", "cross-port-killer": "^1.3.0", "detect-installer": "^1.0.0", "eslint": "^7.32.0", "gh-pages": "^3.2.0", + "husky": "^7.0.4", "jsdom-global": "^3.0.0", "lint-staged": "^10.0.0", "mockjs": "^1.1.0", @@ -138,8 +138,5 @@ "CNAME", "create-umi" ] - }, - "gitHooks": { - "commit-msg": "fabric verify-commit" } }