Merge branch 'develop' into pr/weedySeaDragon/3814

* develop:
  Rerun
  Support for development in Docker
This commit is contained in:
Sidharth Vinod 2023-06-15 12:08:30 +05:30
commit 307aa6f623
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
4 changed files with 67 additions and 0 deletions

2
.gitignore vendored
View File

@ -3,8 +3,10 @@
node_modules/
coverage/
.idea/
.pnpm-store/
dist
v8-compile-cache-0
yarn-error.log
.npmrc

View File

@ -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

9
docker-compose.yml Normal file
View File

@ -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

40
run Executable file
View File

@ -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 <<EOF
Run commonly used commands within docker containers
$0 install # Equvalent of pnpm install
$0 lint # Equvalent of pnpm -w run lint:fix
$0 sh # Open sh inside docker container for development
$0 help # Show this help
EOF
;;
*)
$0 help
;;
esac