Improve precommit
This commit is contained in:
parent
90945d1621
commit
5968090f50
15
piston
15
piston
|
@ -11,6 +11,13 @@ docker_compose(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init_precommit() {
|
||||||
|
if [ $PISTON_ENV == "dev" ]; then
|
||||||
|
rm -f .git/hooks/pre-commit
|
||||||
|
ln -s $(realpath $(dirname "$0"))/pre-commit .git/hooks/pre-commit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
help)
|
help)
|
||||||
echo "=== Piston Management ==="
|
echo "=== Piston Management ==="
|
||||||
|
@ -55,14 +62,16 @@ case $1 in
|
||||||
|
|
||||||
restart) docker_compose restart ;;
|
restart) docker_compose restart ;;
|
||||||
start)
|
start)
|
||||||
rm -f .git/hooks/pre-commit
|
init_precommit
|
||||||
ln -s $(realpath $(dirname "$0"))/pre-commit .git/hooks/pre-commit
|
|
||||||
docker_compose up -d
|
docker_compose up -d
|
||||||
;;
|
;;
|
||||||
stop) docker_compose down ;;
|
stop) docker_compose down ;;
|
||||||
bash) docker_compose exec api /bin/bash ;;
|
bash) docker_compose exec api /bin/bash ;;
|
||||||
|
|
||||||
rebuild) docker_compose build && docker_compose up -d ;;
|
rebuild)
|
||||||
|
init_precommit
|
||||||
|
docker_compose build && docker_compose up -d
|
||||||
|
;;
|
||||||
|
|
||||||
update)
|
update)
|
||||||
git pull
|
git pull
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo "Linting staged files..."
|
echo "Linting staged files..."
|
||||||
npm install
|
npm install > /dev/null || exit 1
|
||||||
|
|
||||||
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
|
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
|
||||||
[ -z "$FILES" ] && exit 0
|
[ -z "$FILES" ] && exit 0
|
||||||
|
|
Loading…
Reference in New Issue