mermaid/run
Nikolay Rozhkov 2a22bae1f9 Update docs
2023-06-25 01:18:38 +03:00

72 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
RUN="docker-compose run --rm"
name=$(basename $0)
command=$1
args=${@:2}
case $command in
sh)
$RUN mermaid sh -c "npx $args"
;;
i | install)
$RUN mermaid sh -c "npx pnpm install $args"
;;
add)
$RUN mermaid sh -c "npx pnpm -w add $args"
;;
test | vitest | e2e )
$RUN mermaid sh -c "npx pnpm $command $args"
;;
prettier)
$RUN mermaid sh -c "npx pnpm prettier --write $args"
;;
lint)
$RUN mermaid sh -c "npx pnpm -w run lint:fix $args"
;;
dev)
$RUN --service-ports mermaid sh -c "npx pnpm run dev"
;;
docs:dev)
$RUN --service-ports mermaid sh -c "npx pnpm --filter mermaid run docs:dev"
;;
help)
usage=$(
cat <<EOF
Run commonly used commands within docker containers
\033[1m$name install\033[0m # Equvalent of pnpm install
\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
$name add # Add package, 'run add d3-sankey'
$name prettier # Prettify a file 'run prettier <path-to-file>'
$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
$name sh # Open sh inside docker container for development
$name help # Show this help
EOF
)
echo -n -e "$usage"
;;
*)
$name help
;;
esac