#!/bin/bash RUN="docker-compose run --rm" # UP="docker-compose up" name=$(basename $0) command=$1 args=${@:2} case $command in sh) $RUN mermaid sh $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" # $UP --rm mermaid sh -c "npx pnpm run dev" ;; help) usage=$( cat <' $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