Skip to content

Commit

Permalink
Fixing issues after review
Browse files Browse the repository at this point in the history
  • Loading branch information
nirname committed Jun 12, 2023
1 parent 094b076 commit 1e36e48
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ coverage/
.pnpm-store/

dist
v8-compile-cache-0

yarn-error.log
.npmrc
Expand Down
20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@ https://docs.github.com/en/get-started/quickstart/fork-a-repo

## 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 -w run lint:fix
pnpm test
```

If you are using docker you may use:
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
git clone git@github.com:mermaid-js/mermaid.git
cd mermaid
docker build -f Dockerfile.dev -t mermaid .
docker run --rm -it -v $(pwd):/mermaid mermaid

npx pnpm install
pnpm -w run lint:fix
pnpm test
./run install # npx pnpm install
./run test # pnpm test
```

## Committing code
Expand Down
8 changes: 0 additions & 8 deletions Dockerfile.dev

This file was deleted.

9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 40 additions & 0 deletions run
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1e36e48

Please sign in to comment.