chore: add husky

This commit is contained in:
Julien Calixte
2024-12-22 23:21:03 +01:00
parent 9725e09c38
commit 420fc50f26
5 changed files with 48 additions and 1 deletions

1
.env.checksum Normal file
View File

@@ -0,0 +1 @@
59c6aadf9774ee13a19485674685f1d3e67171da330713e09e1793a98b39fc90

3
.gitignore vendored
View File

@@ -22,3 +22,6 @@ pnpm-debug.log*
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
# Local Netlify folder
.netlify

31
.husky/pre-push Normal file
View File

@@ -0,0 +1,31 @@
# Define the checksum file
CHECKSUM_FILE=".env.checksum"
# Calculate the current checksum of the .env file
CURRENT_CHECKSUM=$(shasum -a 256 .env | awk '{ print $1 }')
# Check if checksum file exists
if [ -f "$CHECKSUM_FILE" ]; then
# Read the previous checksum
PREVIOUS_CHECKSUM=$(cat "$CHECKSUM_FILE")
# Compare the current checksum with the previous checksum
if [ "$CURRENT_CHECKSUM" = "$PREVIOUS_CHECKSUM" ]; then
echo ".env file has not changed. Skipping Netlify environment import."
exit 0
fi
fi
# If the checksum is different or the file doesn't exist, import the variables
echo "Importing environment variables to Netlify..."
netlify env:import .env
if [ $? -ne 0 ]; then
echo "Failed to import environment variables to Netlify. Aborting push."
exit 1
fi
# Save the new checksum
echo "$CURRENT_CHECKSUM" > "$CHECKSUM_FILE"
echo "Environment variables imported successfully."

View File

@@ -9,7 +9,8 @@
"test": "vitest", "test": "vitest",
"types": "tsc --noEmit", "types": "tsc --noEmit",
"lint": "eslint --ext .ts,.js,.vue --ignore-path .gitignore --fix src", "lint": "eslint --ext .ts,.js,.vue --ignore-path .gitignore --fix src",
"pwa:asset": "npx vue-pwa-asset-generator -a public/img/logo.png --no-manifest" "pwa:asset": "npx vue-pwa-asset-generator -a public/img/logo.png --no-manifest",
"prepare": "husky"
}, },
"dependencies": { "dependencies": {
"@intlify/unplugin-vue-i18n": "^1.6.0", "@intlify/unplugin-vue-i18n": "^1.6.0",
@@ -67,6 +68,7 @@
"eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-unused-imports": "^3.2.0", "eslint-plugin-unused-imports": "^3.2.0",
"eslint-plugin-vue": "^9.31.0", "eslint-plugin-vue": "^9.31.0",
"husky": "^9.1.7",
"prettier": "^3.4.1", "prettier": "^3.4.1",
"sass": "^1.81.0", "sass": "^1.81.0",
"tailwindcss": "^3.4.17", "tailwindcss": "^3.4.17",

10
pnpm-lock.yaml generated
View File

@@ -168,6 +168,9 @@ importers:
eslint-plugin-vue: eslint-plugin-vue:
specifier: ^9.31.0 specifier: ^9.31.0
version: 9.31.0(eslint@8.57.1) version: 9.31.0(eslint@8.57.1)
husky:
specifier: ^9.1.7
version: 9.1.7
prettier: prettier:
specifier: ^3.4.1 specifier: ^3.4.1
version: 3.4.1 version: 3.4.1
@@ -2587,6 +2590,11 @@ packages:
resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==}
engines: {node: '>=16.17.0'} engines: {node: '>=16.17.0'}
husky@9.1.7:
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
engines: {node: '>=18'}
hasBin: true
idb@7.1.1: idb@7.1.1:
resolution: {integrity: sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==} resolution: {integrity: sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==}
@@ -6635,6 +6643,8 @@ snapshots:
human-signals@5.0.0: {} human-signals@5.0.0: {}
husky@9.1.7: {}
idb@7.1.1: {} idb@7.1.1: {}
ignore@5.2.4: {} ignore@5.2.4: {}