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

Commit

Permalink
Restore husky (#444)
Browse files Browse the repository at this point in the history
Restore husky
  • Loading branch information
krysal authored Nov 23, 2021
1 parent 91f963e commit ae327e0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
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
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

0 comments on commit ae327e0

Please sign in to comment.