Skip to content

Commit

Permalink
Update fmt.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Feb 27, 2021
1 parent 74143ad commit b0b6e35
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,27 @@

# Format all scripts.
#
# Usage:
# ./scripts/fmt.sh
#
# Note: This script requires shfmt and prettier.

set -euo pipefail
IFS=$'\n\t'

cd "$(cd "$(dirname "${0}")" && pwd)"/..

# shellcheck disable=SC2046
if [[ -z "${CI:-}" ]]; then
(
set -x
shfmt -l -w ./*/*.sh ./*.sh
prettier -w ./*.js
shfmt -l -w $(git ls-files '*.sh')
prettier -w $(git ls-files '*.js')
)
else
(
set -x
shfmt -d ./*/*.sh ./*.sh
prettier -c ./*.js
shfmt -d $(git ls-files '*.sh')
prettier -c $(git ls-files '*.js')
)
fi

0 comments on commit b0b6e35

Please sign in to comment.