This commit is contained in:
Your Name 2021-08-04 01:34:07 +02:00
parent 647a5b5be9
commit 5649f9a8a4
3 changed files with 14 additions and 1 deletions

12
.hooks/pre-commit Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
FILES=$(git diff --cached --name-only --diff-filter=ACMR -- '*.php' '*.html' '*.yaml' '*.ts' '*.tsx' '*.scss' | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0
# Prettify all selected files
echo "$FILES" | xargs ./node_modules/.bin/prettier --ignore-unknown --write
# Add back the modified/prettified files to staging
echo "$FILES" | xargs git add
exit 0

View File

@ -53,6 +53,7 @@
"typescript": "^4.2.4"
},
"scripts": {
"preinstall": "git config core.hooksPath .hooks",
"build": "rimraf ./assets && parcel build src/index.html --dist-dir assets --public-url '/plugins/germanairlinesva/react/assets' --log-level verbose",
"clean": "rimraf ./assets ./dist ./.parcel-cache",
"format": "prettier --write 'src/**/*.{ts,tsx,scss}'",