1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#!/bin/bash
set -e
PATH=./node_modules/.bin:$PATH
# //////////////////////////////////////////////////////////////////////////////
# START tasks
start_dev() {
echo "Not implemented. Test package via vitest (unit tests)"
}
build() {
echo "Building..."
rm -rf dist
vite build
}
format() {
echo "Running prettier..."
prettier \
--write \
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md,mdx,yml,yaml,html}" \
"tests/**/*.{js,jsx,ts,tsx,json,css,scss,md,mdx,yml,yaml,html}"
}
typecheck() {
echo "Running tsc..."
tsc --noEmit
}
lint() {
echo "Running eslint..."
eslint .
}
test() {
echo "Running vitest..."
vitest run
}
validate() {
typecheck
lint
test
}
clean() {
rm -rf node_modules dist
}
help() {
echo "Usage: $0 <command>"
echo
echo "Commands:"
echo " start_dev Start development server"
echo " build Build for production"
echo " format Format code"
echo " typecheck Typecheck code"
echo " lint Lint code"
echo " test Run tests"
echo " validate Validate code"
echo " clean Clean temporary files/directories"
echo " help Show help"
echo
}
# END tasks
# //////////////////////////////////////////////////////////////////////////////
${@:-help}
|