1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-21 17:34:25 +04:00

add husky with pre-commit script that check if package.json not changed then restore pnpm-lock.yaml

This commit is contained in:
Mikołaj
2025-03-23 13:45:32 +01:00
parent 2f8a37252d
commit 60e87c71c9
3 changed files with 27 additions and 0 deletions

16
.husky/pre-commit Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/sh
if git diff --quiet --cached package.json; then
if git diff --quiet --cached pnpm-lock.yaml; then
echo "pnpm-lock.yaml not changed, nothing to do."
else
echo "pnpm-lock.yaml changed, restore..."
git restore --staged pnpm-lock.yaml
git checkout pnpm-lock.yaml
echo "Restored pnpm-lock.yaml."
fi
else
echo "package.json changed, pnpm-lock.yaml change"
fi
exit 0

View File

@@ -31,6 +31,7 @@
"concurrently": "^9.1.2",
"cross-env": "^7.0.3",
"glob": "^11.0.1",
"husky": "^9.1.7",
"nodemon": "^3.1.9",
"pnpm": "10.6.4",
"postcss": "^8.5.3",

10
pnpm-lock.yaml generated
View File

@@ -50,6 +50,9 @@ importers:
glob:
specifier: ^11.0.1
version: 11.0.1
husky:
specifier: ^9.1.7
version: 9.1.7
nodemon:
specifier: ^3.1.9
version: 3.1.9
@@ -1472,6 +1475,11 @@ packages:
resolution: {integrity: sha512-3gKm/gCSUipeLsRYZbbdA1BD83lBoWUkZ7G9VFrhWPAU76KwYo5KR8V28bpoPm/ygy0x5/GCbpRQdY7VLYCoIg==}
hasBin: true
husky@9.1.7:
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
engines: {node: '>=18'}
hasBin: true
iconv-lite@0.4.24:
resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
engines: {node: '>=0.10.0'}
@@ -4021,6 +4029,8 @@ snapshots:
human-id@4.1.1: {}
husky@9.1.7: {}
iconv-lite@0.4.24:
dependencies:
safer-buffer: 2.1.2