Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Preview PRs with mermaid-live-editor on Netlify #4769

Merged
merged 3 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Settings in the [build] context are global and are applied to
# all contexts unless otherwise overridden by more specific contexts.
[build]
# Directory where the build system installs dependencies
# and runs your build. Store your package.json, .nvmrc, etc here.
# If not set, defaults to the root directory.
base = ""

# Directory that contains the deploy-ready HTML files and
# assets generated by the build. This is an absolute path relative
# to the base directory, which is the root by default (/).
# This sample publishes the directory located at the absolute
# path "root/project/build-output"

publish = "mermaid-live-editor/docs"

# Default build command.
command = "./scripts/editor.bash"
24 changes: 24 additions & 0 deletions scripts/editor.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -euxo pipefail
# We have to use npm instead of yarn because it causes trouble in netlify

# Link local mermaid to npm
pushd packages/mermaid
npm link
popd

# Clone the Mermaid Live Editor repository
git clone https://github.com/mermaid-js/mermaid-live-editor.git

# Change to the repository directory
cd mermaid-live-editor

# Link local mermaid to live editor
npm link mermaid

# Install dependencies
npm install

# Build the site
npm run build