Skip to content

Commit 9243f44

Browse files
committed
chore: 🤖 avoid changing the version field in package.json along with other changes with husky
1 parent fe327df commit 9243f44

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎.husky/pre-commit‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
if [[ -n `git diff --cached -G '"version":' --numstat package.json` ]] && ([[ `git diff --cached -G '"version":' --numstat package.json | awk '{print $1}'` -ne 1 ]] || [[ `git diff --cached --name-only | wc -l` -ne 1 ]]); then
2+
echo "\033[30;41m\n\n[Error] Don't commit a change to the \"version\" field in package.json along with other changes.\033[m\n\n";
3+
exit 1;
4+
fi

‎package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@types/node": "~20",
2323
"@types/prettier": "^3.0.0",
2424
"@vitest/coverage-v8": "~2.1",
25+
"husky": "^9.1.7",
2526
"prettier": "^3.0",
2627
"prettier-plugin-tailwindcss": "^0.6",
2728
"rimraf": "~6.0",
@@ -34,6 +35,7 @@
3435
"prettier-plugin-tailwindcss": "^0.6"
3536
},
3637
"scripts": {
38+
"prepare": "husky",
3739
"start": "node dist/index.js",
3840
"clean": "rimraf coverage dist tmp",
3941
"prebuild": "biome lint",

‎pnpm-lock.yaml‎

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)