mermaid/run

67 lines
1.6 KiB
Plaintext
Raw Normal View History

#!/bin/bash
RUN="docker-compose run --rm"
2023-06-18 00:32:45 +02:00
name=$(basename $0)
command=$1
args=${@:2}
case $command in
sh)
2023-06-25 00:18:38 +02:00
$RUN mermaid sh -c "npx $args"
;;
2023-06-27 13:11:06 +02:00
pnpm)
$RUN mermaid sh -c "npx $command $args"
;;
2023-06-18 00:32:45 +02:00
dev)
$RUN --service-ports mermaid sh -c "npx pnpm run dev"
2023-06-25 00:18:38 +02:00
;;
docs:dev)
$RUN --service-ports mermaid sh -c "cd packages/mermaid/src/docs && npx pnpm prefetch && npx vitepress --port 3333 --host"
2023-06-18 00:32:45 +02:00
;;
help)
2023-06-18 00:32:45 +02:00
usage=$(
cat <<EOF
2023-06-27 13:11:06 +02:00
Run commands within docker containers.
Development quick start guide:
\033[1m$name pnpm install\033[0m # Install packages
\033[1m$name dev\033[0m # Run dev server with examples, open http://localhost:9000
\033[1m$name docs:dev\033[0m # For docs contributions, open http://localhost:3333
2023-06-18 00:32:45 +02:00
2023-06-27 13:11:06 +02:00
Commands:
$name pnpm # Run any 'pnpm' command
$name dev # Run dev server with examples, open http://localhost:9000
$name docs:dev # For docs contributions, open http://localhost:3333
2023-06-27 13:11:06 +02:00
$name sh # Open 'sh' inside docker container for development
2023-06-18 00:32:45 +02:00
$name help # Show this help
2023-06-27 13:11:06 +02:00
Examples of frequiently used commands:
$name pnpm add # Add package, 'run add d3-sankey'
$name pnpm prettier --write # Prettify a file 'run prettier <path-to-file>'
# git diff --name-only develop | xargs run pnpm prettier --write
$name pnpm test # Run unit tests
$name pnpm vitest # Run watcher for unit tests
$name pnpm e2e # Run integration tests
2023-06-27 13:11:06 +02:00
$name pnpm -w run lint:fix
EOF
2023-06-18 00:32:45 +02:00
)
echo -n -e "$usage"
;;
*)
2023-06-18 00:32:45 +02:00
$name help
;;
2023-06-19 03:34:41 +02:00
esac