Files
mermaid/scripts/editor.bash
Alois Klink 141c6b3808 build: change mermaid live preview to use pnpm
Right now, the netlify build seems to be failing since we're ignoring
the `mermaid-live-editor` lockfile.

This is causing errors with broken dependencies.

Switching to `pnpm`, which the `mermaid-live-editor` uses, fixes these
issues!
2025-09-13 00:35:29 +09:00

39 lines
868 B
Bash
Executable File

#!/usr/bin/env bash
# Fail on errors
set -euxo pipefail
export COREPACK_ENABLE_STRICT='0'
# Increase heap size
export NODE_OPTIONS="--max_old_space_size=4096"
pushd packages/mermaid
# Append commit hash to version
jq ".version = .version + \"+${COMMIT_REF:0:7}\"" package.json > package.tmp.json
mv package.tmp.json package.json
popd
pnpm run -r clean
pnpm build:esbuild
pnpm build:types
# Clone the Mermaid Live Editor repository
if [ ! -d "mermaid-live-editor" ]; then
git clone --single-branch https://github.com/mermaid-js/mermaid-live-editor.git
fi
cd mermaid-live-editor
git clean -xdf
rm -rf docs/
# Tells PNPM that mermaid-live-editor is not part of this workspace
touch pnpm-workspace.yaml
# Install dependencies
pnpm install --frozen-lockfile
# Link local mermaid to live editor
pnpm link ../packages/mermaid
# Force Build the site
pnpm run build