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'
services:
mermaid:
image: node:18.19.0-alpine3.18
build:
context: .
dockerfile: Dockerfile
stdin_open: true
tty: true
working_dir: /mermaid
mem_limit: '8G'
entrypoint: "/mermaid/docker-entrypoint.sh"
environment:
- NODE_OPTIONS=--max_old_space_size=8192
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:
- [volta](https://volta.sh/) to manage node versions.
- [Node.js](https://nodejs.org/en/). `volta install node`
- [pnpm](https://pnpm.io/) package manager. `volta install pnpm`
- [Node.js](https://nodejs.org/en/).
- [pnpm](https://pnpm.io/) package manager.
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
curl -fsSL https://get.pnpm.io/install.sh | sh -
pnpm env use --global 18
```
You may also need to reload `.shrc` or `.bashrc` afterwards.
**Docker**
[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
RUN="docker-compose run --rm"
RUN="docker compose run --rm"
ansi() { echo -e "\e[${1}m${*:2}\e[0m"; }
bold() { ansi 1 "$@"; }
@ -14,16 +14,20 @@ args=${@:2}
case $command in
build)
docker compose build $args
;;
sh)
$RUN mermaid sh -c "npx $args"
$RUN mermaid sh # -c "npx $args"
;;
pnpm)
$RUN mermaid sh -c "npx pnpm $args"
$RUN mermaid sh -c "pnpm $args"
;;
dev)
$RUN --service-ports mermaid sh -c "npx pnpm run dev"
$RUN --service-ports mermaid sh -c "pnpm run 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.
__________________________________________________________________________________________
Development quick start guide:
Development Quick Start Guide:
$(bold ./$name pnpm install) # Install packages
$(bold ./$name dev) # Run dev server with examples, open http://localhost:9000
$(bold ./$name pnpm vitest) # Run watcher for unit tests
$(bold ./$name cypress) # Run integration tests (after starting dev server)
$(bold ./$name pnpm build) # Prepare it for production
$(bold ./$name docs:dev) # Then add documentation, open http://localhost:3333
$(bold ./$name pnpm install) # Install packages
$(bold ./$name dev) # Launch dev server with examples, open http://localhost:9000
$(bold ./$name docs:dev) # Launch official website, open http://localhost:3333
$(bold ./$name pnpm vitest) # Run watcher for unit tests
$(bold ./$name cypress) # Run integration tests (after starting dev server)
$(bold ./$name pnpm build) # Prepare it for production
__________________________________________________________________________________________
Commands:
$(bold ./$name pnpm) # Run any 'pnpm' command
$(bold ./$name dev) # Run dev server with examples, open http://localhost:9000
$(bold ./$name docs:dev) # For docs contributions, open http://localhost:3333
$(bold ./$name cypress) # Run integration tests
$(bold ./$name sh) # Open 'sh' inside docker container for development
$(bold ./$name help) # Show this help
$(bold ./$name build) # Build image
$(bold ./$name cypress) # Run integration tests
$(bold ./$name dev) # Run dev server with examples, open http://localhost:9000
$(bold ./$name docs:dev) # For docs contributions, open http://localhost:3333
$(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:
@ -81,7 +87,7 @@ $(bold ./$name cypress open --project .)
Open cypress interactive GUI
$(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:)
Allow local connections for x11 server