Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Restore husky #444

Merged
merged 2 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# Generate a new openverse.pot file if en.json has changes
TRANSFILE=src/locales/en.json
POTFILE=src/locales/po-files/openverse.pot
CHANGED=$(git diff --staged --name-only HEAD)

if [[ "$CHANGED" == *"$TRANSFILE"* ]] && [[ "$CHANGED" != *"$POTFILE"* ]]; then
npm run i18n:generate-pot
git add $POTFILE
fi

# Lint staged files
npx lint-staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm test
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"format:test": "prettier --check .",
"vue-i18n-extract": "vue-i18n-extract report -v './src/**/*.?(js|vue)' -l './src/locales/*.?(json)'",
"postinstall": "patch-package",
"prepare": "husky install",
"i18n:get-valid-locales": "node src/locales/scripts/get-validated-locales",
"i18n:get-translations": "node src/locales/scripts/get-translations && npm run i18n:get-valid-locales",
"i18n:generate-pot": "node src/locales/scripts/json-to-pot",
Expand Down Expand Up @@ -95,6 +96,7 @@
"eslint-plugin-vue": "^7.8.0",
"eslint-plugin-vuejs-accessibility": "^0.6.1",
"glob": "^7.1.6",
"husky": "^7.0.1",
"jest": "^26.6.3",
"jest-transform-stub": "^2.0.0",
"lint-staged": "^11.1.1",
Expand Down