| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Fail on errors |
| 4 | set -euxo pipefail |
| 5 | export COREPACK_ENABLE_STRICT='0' |
| 6 | |
| 7 | # Increase heap size |
| 8 | export NODE_OPTIONS="--max_old_space_size=4096" |
| 9 | |
| 10 | pushd packages/mermaid |
| 11 | # Append commit hash to version |
| 12 | jq ".version = .version + \"+${COMMIT_REF:0:7}\"" package.json > package.tmp.json |
| 13 | mv package.tmp.json package.json |
| 14 | popd |
| 15 | |
| 16 | pnpm run -r clean |
| 17 | pnpm build:esbuild |
| 18 | pnpm build:types |
| 19 | |
| 20 | # Clone the Mermaid Live Editor repository |
| 21 | if [ ! -d "mermaid-live-editor" ]; then |
| 22 | git clone --single-branch https://github.com/mermaid-js/mermaid-live-editor.git |
| 23 | fi |
| 24 | cd mermaid-live-editor |
| 25 | git clean -xdf |
| 26 | rm -rf docs/ |
| 27 | |
| 28 | # Tells PNPM that mermaid-live-editor is not part of this workspace |
| 29 | touch pnpm-workspace.yaml |
| 30 | |
| 31 | # Install dependencies |
| 32 | pnpm install --frozen-lockfile |
| 33 | |
| 34 | # Link local mermaid to live editor |
| 35 | pnpm link ../packages/mermaid |
| 36 | |
| 37 | # Force Build the site |
| 38 | pnpm run build |
| 39 | |