mermaid/run

63 lines
1.0 KiB
Plaintext
Raw Normal View History

#!/bin/bash
RUN="docker-compose run --rm"
2023-06-18 00:32:45 +02:00
# UP="docker-compose up"
name=$(basename $0)
command=$1
args=${@:2}
2023-06-18 00:32:45 +02:00
case $command in
sh)
$RUN mermaid sh $args
;;
2023-06-18 00:32:45 +02:00
i | install)
$RUN mermaid sh -c "npx pnpm install"
;;
test)
$RUN mermaid sh -c "npx pnpm test"
;;
2023-06-18 00:32:45 +02:00
e2e)
$RUN mermaid sh -c "npx pnpm e2e"
;;
lint)
$RUN mermaid sh -c "npx pnpm -w run lint:fix"
;;
2023-06-18 00:32:45 +02:00
dev)
$RUN --service-ports mermaid sh -c "npx pnpm run dev"
# $UP --rm mermaid sh -c "npx pnpm run dev"
;;
help)
2023-06-18 00:32:45 +02:00
usage=$(
cat <<EOF
Run commonly used commands within docker containers
2023-06-18 00:32:45 +02:00
\033[1m$name install\033[0m # Equvalent of pnpm install
2023-06-18 00:32:45 +02:00
\033[1m$name dev\033[0m # Run dev server with examples, open http://localhost:9000
2023-06-18 00:32:45 +02:00
$name lint # Equvalent of pnpm -w run lint:fix
$name test # Run unit tests
$name vitest # Run watcher for unit tests
$name e2e # Run integration tests
2023-06-18 00:32:45 +02:00
$name sh # Open sh inside docker container for development
$name help # Show this help
EOF
2023-06-18 00:32:45 +02:00
)
echo -n -e "$usage"
;;
*)
2023-06-18 00:32:45 +02:00
$name help
;;
esac