Fix up prettier wrapper script
This commit is contained in:
13
prettier.sh
13
prettier.sh
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
@@ -7,18 +7,21 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
|
|
||||||
source "$DIR/_reformat-common.bash"
|
source "$DIR/_reformat-common.bash"
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
file="$1"
|
file="$1"
|
||||||
|
|
||||||
wrflog running against file "$file"
|
pushd "$(dirname "$file")" 2>&1
|
||||||
|
|
||||||
if [[ "$WOULD_REFORMAT" = "would_reformat" ]] ; then
|
if [[ "$WOULD_REFORMAT" = "would_reformat" ]]; then
|
||||||
|
set +e
|
||||||
out=$(npx prettier --check "$file" 2>&1 >/dev/null)
|
out=$(npx prettier --check "$file" 2>&1 >/dev/null)
|
||||||
retval="$?"
|
retval="$?"
|
||||||
echo "$out"
|
set -e
|
||||||
exit "$retval"
|
exit "$retval"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$WOULD_REFORMAT" = "do_reformat" ]] ; then
|
if [[ "$WOULD_REFORMAT" = "do_reformat" ]]; then
|
||||||
out=$(npx prettier --write "$file" 2>&1 >/dev/null)
|
out=$(npx prettier --write "$file" 2>&1 >/dev/null)
|
||||||
retval="$?"
|
retval="$?"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user