Hooks
This commit is contained in:
parent
647a5b5be9
commit
5649f9a8a4
12
.hooks/pre-commit
Executable file
12
.hooks/pre-commit
Executable 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
|
||||
|
||||
@ -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}'",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user