diff --git a/.gitignore b/.gitignore index 7b9ec5c4c..8348f4ae4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,10 @@ node_modules/ coverage/ .idea/ +.pnpm-store/ dist +v8-compile-cache-0 yarn-error.log .npmrc diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a9837b06a..e8ac09325 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,14 +14,30 @@ Please read in detail about how to contribute documentation and code on the [Mer ## Development Installation +If you don't have direct access to push to mermaid repositories, make a fork first. Then clone. Or clone directly from mermaid-js: + ```bash git clone git@github.com:mermaid-js/mermaid.git cd mermaid +``` + +Install required packages: + +```bash # npx is required for first install as volta support for pnpm is not added yet. npx pnpm install pnpm test ``` +### Docker + +If you are using docker and docker-compose, you have self-documented `run` bash script, which is a convenient alias for docker-compose commands: + +```bash +./run install # npx pnpm install +./run test # pnpm test +``` + ## Testing ```bash diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..2762f3b99 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3.9' +services: + mermaid: + image: node:18.16.0-alpine3.18 + stdin_open: true + tty: true + working_dir: /mermaid + volumes: + - ./:/mermaid diff --git a/run b/run new file mode 100755 index 000000000..6afe76eee --- /dev/null +++ b/run @@ -0,0 +1,40 @@ +#!/bin/bash +RUN="docker-compose run --rm" +command=$1 +args=${@:2} + +case $command in + +sh) +$RUN mermaid sh $args +;; + +install) +$RUN mermaid sh -c "npx pnpm install" +;; + +test) +$RUN mermaid sh -c "npx pnpm test" +;; + +lint) +$RUN mermaid sh -c "npx pnpm -w run lint:fix" +;; + +help) +cat <