Skip to content

Commit ceabfd4

Browse files
authored
Replace Mermaid plugin to be backed by Playwright (#689)
* Replace Mermaid plugin to be backed by Playwright * Prepare, so we don't force consumers to run this * README * Make more sense
1 parent 864cdab commit ceabfd4

10 files changed

+190
-725
lines changed

.changeset/neat-wasps-admire.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'scoobie': major
3+
---
4+
5+
Replace Mermaid plugin to be backed by Playwright
6+
7+
Previously, the Mermaid plugin was backed by Puppeteer. This change replaces this via `mermaid-isomorphic`, in turn backed by Playwright.
8+
9+
There are some consequences for Mermaid users:
10+
11+
- Output changes (you should review and tweak these)
12+
- You'll no longer need to install puppeteer and manage it in e.g. your Dockerfiles
13+
- Before running builds with this change, you'll need to install `mermaid-isomorphic` (which is now a `scoobie` peer dependency), and `playwright` in order to run `<packageManager> playwright install chromium`. This could form a postinstall script.

README.md

+2-11
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ export const App = () => (
177177

178178
Scoobie optionally supports simple, source-controlled diagrams via [mermaid].
179179

180-
This requires the `mermaid` configuration option to be set on [ScoobieWebpackPlugin](#scoobiewebpackplugin),
181-
and `@mermaid-js/mermaid-cli` to be installed as a peer dependency.
180+
This requires the `mermaid` configuration option to be set on [ScoobieWebpackPlugin](#scoobiewebpackplugin), and the `mermaid-isomorphic` peer dependency installed.
181+
A playwright installattion of chromium is required, which can be done by installing `playwright` and executing `playwright install chromium`.
182182
From there, the easiest way to get started is to check out the [mermaid live editor].
183183

184184
You can use a named code block in Markdown files:
@@ -194,16 +194,7 @@ sequenceDiagram
194194
```
195195
````
196196

197-
Or import an `.mmd` file like so:
198-
199-
```markdown
200-
![Diagram](./diagram.mmd 'Optional title')
201-
```
202-
203-
If you use a separate `diagram.mmd` file, you can provide [additional mermaid configuration] with a `diagram.mmd.json` file in the same directory.
204-
205197
[mermaid live editor]: https://mermaidjs.github.io/mermaid-live-editor
206-
[additional mermaid configuration]: https://mermaid-js.github.io/mermaid/#/mermaidAPI?id=configuration
207198

208199
### Headings
209200

package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
"svgo": "^3.0.0",
2525
"svgo-loader": "^4.0.0",
2626
"unist-util-visit": "^2.0.3",
27+
"unist-util-visit-parents": "^3.1.1",
2728
"webpack-merge": "^6.0.0",
2829
"which": "^4.0.0"
2930
},
3031
"devDependencies": {
3132
"@changesets/cli": "2.27.7",
3233
"@changesets/get-github-info": "0.6.0",
3334
"@mdx-js/loader": "^1.6.22",
34-
"@mermaid-js/mermaid-cli": "10.9.1",
3535
"@storybook/addon-essentials": "8.2.9",
3636
"@storybook/addon-webpack5-compiler-babel": "3.0.3",
3737
"@storybook/react": "8.2.9",
@@ -40,6 +40,8 @@
4040
"@types/react-dom": "18.3.0",
4141
"braid-design-system": "32.23.1",
4242
"loki": "0.35.0",
43+
"mermaid-isomorphic": "2.2.1",
44+
"playwright": "1.46.1",
4345
"react": "18.3.1",
4446
"react-dom": "18.3.1",
4547
"react-helmet-async": "1.3.0",
@@ -58,17 +60,17 @@
5860
],
5961
"peerDependencies": {
6062
"@mdx-js/loader": "^1.6.22",
61-
"@mermaid-js/mermaid-cli": ">= 8.13.7 < 11",
6263
"braid-design-system": ">= 31.21.0",
64+
"mermaid-isomorphic": "^2.2.1",
6365
"react": ">= 17 < 19",
6466
"react-router-dom": ">= 5.3.0",
6567
"sku": ">= 13.0.0 < 14"
6668
},
6769
"peerDependenciesMeta": {
68-
"@mermaid-js/mermaid-cli": {
70+
"@mdx-js/loader": {
6971
"optional": true
7072
},
71-
"@mdx-js/loader": {
73+
"mermaid-isomorphic": {
7274
"optional": true
7375
}
7476
},
@@ -87,7 +89,8 @@
8789
"storybook:build": "storybook build --output-dir dist-storybook",
8890
"storybook:start": "storybook dev",
8991
"test": "sku test",
90-
"test:ci": "sku test --coverage"
92+
"test:ci": "sku test --coverage",
93+
"prepare": "playwright install chromium"
9194
},
9295
"loki": {
9396
"configurations": {

remark/mermaid/LICENSE

-23
This file was deleted.

remark/mermaid/README.md

-13
This file was deleted.

0 commit comments

Comments
 (0)