Skip to content

Commit

Permalink
Support for development in Docker
Browse files Browse the repository at this point in the history
Updated lintignore and move dockerfile to .dev

Fix

Updated contributing

Fixing GA

Fix contributing.md

Fixing issues after review

No need to change .eslintignore
  • Loading branch information
nirname committed Jun 12, 2023
1 parent af13f34 commit cdea0ea
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -3,8 +3,10 @@
node_modules/
coverage/
.idea/
.pnpm-store/

dist
v8-compile-cache-0

yarn-error.log
.npmrc
Expand Down
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -18,14 +18,28 @@ 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 test
```

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

## Committing code

We make all changes via pull requests. As we have many pull requests from developers new to mermaid, the current approach is to have _knsv, Knut Sveidqvist_ as a main reviewer of changes and merging pull requests. More precisely like this:
Expand Down
9 changes: 9 additions & 0 deletions 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
40 changes: 40 additions & 0 deletions 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 <<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 cdea0ea

Please sign in to comment.