Removed volta requirement, leave pnpm only

This commit is contained in:
Nikolay Rozhkov 2024-01-13 15:19:36 +03:00
parent a3092fc174
commit f6b321d769
5 changed files with 38 additions and 23 deletions

2
Dockerfile Normal file
View File

@ -0,0 +1,2 @@
FROM node:18.19.0-alpine3.18 AS base
RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh -

View File

@ -1,11 +1,14 @@
version: '3.9' version: '3.9'
services: services:
mermaid: mermaid:
image: node:18.19.0-alpine3.18 build:
context: .
dockerfile: Dockerfile
stdin_open: true stdin_open: true
tty: true tty: true
working_dir: /mermaid working_dir: /mermaid
mem_limit: '8G' mem_limit: '8G'
entrypoint: "/mermaid/docker-entrypoint.sh"
environment: environment:
- NODE_OPTIONS=--max_old_space_size=8192 - NODE_OPTIONS=--max_old_space_size=8192
volumes: volumes:

3
docker-entrypoint.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
source /root/.shrc
exec "$@"

View File

@ -45,17 +45,18 @@ We support **development within Docker** environment along with **host setup**.
These are the tools we use for working with the code and documentation: These are the tools we use for working with the code and documentation:
- [volta](https://volta.sh/) to manage node versions. - [Node.js](https://nodejs.org/en/).
- [Node.js](https://nodejs.org/en/). `volta install node` - [pnpm](https://pnpm.io/) package manager.
- [pnpm](https://pnpm.io/) package manager. `volta install pnpm`
In case you do not use `volta` the following commands must be sufficient enough to start with: The following commands must be sufficient enough to start with:
```bash ```bash
curl -fsSL https://get.pnpm.io/install.sh | sh - curl -fsSL https://get.pnpm.io/install.sh | sh -
pnpm env use --global 18 pnpm env use --global 18
``` ```
You may also need to reload `.shrc` or `.bashrc` afterwards.
**Docker** **Docker**
[Install Docker](https://docs.docker.com/engine/install/). And that is pretty much all you need. [Install Docker](https://docs.docker.com/engine/install/). And that is pretty much all you need.

42
run
View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
RUN="docker-compose run --rm" RUN="docker compose run --rm"
ansi() { echo -e "\e[${1}m${*:2}\e[0m"; } ansi() { echo -e "\e[${1}m${*:2}\e[0m"; }
bold() { ansi 1 "$@"; } bold() { ansi 1 "$@"; }
@ -14,16 +14,20 @@ args=${@:2}
case $command in case $command in
build)
docker compose build $args
;;
sh) sh)
$RUN mermaid sh -c "npx $args" $RUN mermaid sh # -c "npx $args"
;; ;;
pnpm) pnpm)
$RUN mermaid sh -c "npx pnpm $args" $RUN mermaid sh -c "pnpm $args"
;; ;;
dev) dev)
$RUN --service-ports mermaid sh -c "npx pnpm run dev" $RUN --service-ports mermaid sh -c "pnpm run dev"
;; ;;
docs:dev) docs:dev)
@ -46,24 +50,26 @@ Welcome! Thank you for joining the development.
This is a script for running commands within docker containers at ease. This is a script for running commands within docker containers at ease.
__________________________________________________________________________________________ __________________________________________________________________________________________
Development quick start guide: Development Quick Start Guide:
$(bold ./$name pnpm install) # Install packages $(bold ./$name pnpm install) # Install packages
$(bold ./$name dev) # Run dev server with examples, open http://localhost:9000 $(bold ./$name dev) # Launch dev server with examples, open http://localhost:9000
$(bold ./$name pnpm vitest) # Run watcher for unit tests $(bold ./$name docs:dev) # Launch official website, open http://localhost:3333
$(bold ./$name cypress) # Run integration tests (after starting dev server)
$(bold ./$name pnpm build) # Prepare it for production $(bold ./$name pnpm vitest) # Run watcher for unit tests
$(bold ./$name docs:dev) # Then add documentation, open http://localhost:3333 $(bold ./$name cypress) # Run integration tests (after starting dev server)
$(bold ./$name pnpm build) # Prepare it for production
__________________________________________________________________________________________ __________________________________________________________________________________________
Commands: Commands:
$(bold ./$name pnpm) # Run any 'pnpm' command $(bold ./$name build) # Build image
$(bold ./$name dev) # Run dev server with examples, open http://localhost:9000 $(bold ./$name cypress) # Run integration tests
$(bold ./$name docs:dev) # For docs contributions, open http://localhost:3333 $(bold ./$name dev) # Run dev server with examples, open http://localhost:9000
$(bold ./$name cypress) # Run integration tests $(bold ./$name docs:dev) # For docs contributions, open http://localhost:3333
$(bold ./$name sh) # Open 'sh' inside docker container for development $(bold ./$name help) # Show this help
$(bold ./$name help) # Show this help $(bold ./$name pnpm) # Run any 'pnpm' command
$(bold ./$name sh) # Open 'sh' inside docker container for development
__________________________________________________________________________________________ __________________________________________________________________________________________
Examples of frequiently used commands: Examples of frequiently used commands:
@ -81,7 +87,7 @@ $(bold ./$name cypress open --project .)
Open cypress interactive GUI Open cypress interactive GUI
$(bold ./$name cypress run --spec cypress/integration/rendering/)$(underline test.spec.ts) $(bold ./$name cypress run --spec cypress/integration/rendering/)$(underline test.spec.ts)
Run specific test in cypress\n Run specific test in cypress
$(bold xhost +local:) $(bold xhost +local:)
Allow local connections for x11 server Allow local connections for x11 server