Files
gog_frontend/do.sh
Deepak ec673515b8
All checks were successful
gitea-deepak/gog_frontend/pipeline/head This commit looks good
Adds command to update jest snapshots
2021-01-24 13:15:44 -06:00

41 lines
780 B
Bash

#!/usr/bin/env bash
# Do - The Simplest Build Tool on Earth.
# Documentation and examples see https://github.com/8gears/do
set -Eeuo pipefail # -e "Automatic exit from bash shell script on error" -u "Treat unset variables and parameters as errors"
build() {
echo "I am ${FUNCNAME[0]}ing"
npx webpack --mode production
}
run() {
echo "I am ${FUNCNAME[0]}ning"
API_ROOT=http://localhost:3000/api npx webpack serve
}
fmt() {
npx prettier --write .
}
_lint() {
npx eslint src --ext .js,.jsx
}
_jest() {
npx jest --ci --coverage
}
_jestUpdateSnaps() {
npx jest -u
}
test() {
echo "I am ${FUNCNAME[0]}ing"
_lint && _jest
}
"$@" # <- execute the task
[ "$#" -gt 0 ] || printf "Usage:\n\t./do.sh %s\n" "($(compgen -A function | grep '^[^_]' | paste -sd '|' -))"