#!/bin/sh -eu

cd "$RUN_DIR"

if [ "${1:-}" = '--fix' ]; then
    mode=fix
else
    mode=check
fi

if [ "$mode" = 'fix' ]; then
    prettier_opts=--write
else
    prettier_opts=--check
fi

[ -z "${DEBUG:-}" ] || set -x

cd unwind-ui
npm run lint ||:
npx --no -- prettier $prettier_opts 'vite.config.ts' 'src/**/*.{js,ts,vue}'
