mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-21 06:53:17 +08:00
Merge pull request #4478 from nirname/feature/docker-development-support
Support for development in Docker
This commit is contained in:
commit
8426716886
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,8 +3,10 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
coverage/
|
coverage/
|
||||||
.idea/
|
.idea/
|
||||||
|
.pnpm-store/
|
||||||
|
|
||||||
dist
|
dist
|
||||||
|
v8-compile-cache-0
|
||||||
|
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
.npmrc
|
.npmrc
|
||||||
|
@ -18,14 +18,28 @@ https://docs.github.com/en/get-started/quickstart/fork-a-repo
|
|||||||
|
|
||||||
## Development Installation
|
## 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
|
```bash
|
||||||
git clone git@github.com:mermaid-js/mermaid.git
|
git clone git@github.com:mermaid-js/mermaid.git
|
||||||
cd mermaid
|
cd mermaid
|
||||||
|
```
|
||||||
|
|
||||||
|
Install required packages:
|
||||||
|
|
||||||
|
```bash
|
||||||
# npx is required for first install as volta support for pnpm is not added yet.
|
# npx is required for first install as volta support for pnpm is not added yet.
|
||||||
npx pnpm install
|
npx pnpm install
|
||||||
pnpm test
|
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
|
## 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:
|
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:
|
||||||
|
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal 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
40
run
Executable 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
|
Loading…
x
Reference in New Issue
Block a user