From a06f7d2e39cf55bd0d0623207f39babc5c4d41a4 Mon Sep 17 00:00:00 2001 From: Niloofar Date: Fri, 13 Oct 2023 15:01:52 +0800 Subject: [PATCH] build: added pre-commit and commitlint configs --- commitlint.config.js | 1 + package-lock.json | 22 +++++++++++++++++++--- package.json | 11 +++++++++-- 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 commitlint.config.js diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000000..28fe5c5bf9 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1 @@ +module.exports = {extends: ['@commitlint/config-conventional']} diff --git a/package-lock.json b/package-lock.json index 6ada7cf3a2..a3ffe2e16c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "@vitest/coverage-v8": "^0.34.6", "autoprefixer": "^10.4.16", "eslint-plugin-react-refresh": "^0.4.3", + "husky": "^8.0.3", "jsdom": "^22.1.0", "postcss": "^8.4.31", "prettier": "3.0.3", @@ -4541,9 +4542,9 @@ } }, "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "dev": true, "engines": { "node": "*" @@ -4816,6 +4817,21 @@ "node": ">= 6" } }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", diff --git a/package.json b/package.json index 965e2b33d9..3073cb3c0e 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,12 @@ "prettier": "prettier --write \"./src/**/*.{js,jsx,ts,tsx}\"", "preview": "vite preview", "test": "vitest", - "test:coverage": "vitest run --coverage" + "test:coverage": "vitest run --coverage", + "precommit": "npm run lint && npm run test && npm run prettier" }, "dependencies": { - "clsx": "^2.0.0", "class-variance-authority": "^0.7.0", + "clsx": "^2.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", "tailwind-merge": "^1.14.0", @@ -32,6 +33,7 @@ "@vitest/coverage-v8": "^0.34.6", "autoprefixer": "^10.4.16", "eslint-plugin-react-refresh": "^0.4.3", + "husky": "^8.0.3", "jsdom": "^22.1.0", "postcss": "^8.4.31", "prettier": "3.0.3", @@ -40,5 +42,10 @@ "typescript": "^5.0.2", "vite": "^4.4.5", "vitest": "^0.34.5" + }, + "husky": { + "hooks": { + "pre-commit": "npm run precommit" + } } }