Fix up prettier wrapper script

This commit is contained in:
Michael Wolf
2023-09-30 17:33:20 -06:00
parent 4c598c589e
commit 0273d5762e

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash
set -uo pipefail
IFS=$'\n\t'
@@ -7,18 +7,21 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$DIR/_reformat-common.bash"
set -e
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)
retval="$?"
echo "$out"
set -e
exit "$retval"
fi
if [[ "$WOULD_REFORMAT" = "do_reformat" ]] ; then
if [[ "$WOULD_REFORMAT" = "do_reformat" ]]; then
out=$(npx prettier --write "$file" 2>&1 >/dev/null)
retval="$?"