mermaid-js / mermaid-cli

Command line tool for the Mermaid library
MIT License
2.31k stars 223 forks source link

BSD Support #603

Open anoduck opened 10 months ago

anoduck commented 10 months ago

Is your feature request related to a problem? Please describe. Mermaid-Cli does not work under BSD, this is because it uses puppeteer as a dependency. The developer of Puppeteer refuses to support BSD, and he isn't even nice about it.

Describe the solution you'd like I am not sure what feature puppeteer is used for, but it would nice if either a different library could be used, or the feature using puppeteer could be disabled during the build process to provide support.

aloisklink commented 10 months ago

Unfortunately, Mermaid currently only works in a browser environment (see https://github.com/mermaid-js/mermaid/issues/3650), so we need a library like puppeteer to automatically run a browser.

We could replace puppeteer with a library like Playwright, but:


From doing a quick search, it might be possible to run Puppeteer on any already downloaded version of Chromium compiled for FreeBSD/OpenBSD. You should just be able to install with the PUPPETEER_SKIP_DOWNLOAD=1 environment variable set, then start puppeteer (or mermaid-cli), setting the executablePath option, see https://github.com/puppeteer/puppeteer/issues/5034#issuecomment-1236913615

This is essentially what we do on Alpine Linux, which doesn't use glibc.

To be honest, I don't really blame puppeteer developers for not officially supporting BSD. With Cirrus CI limiting free usage, there isn't really a free CI service that has any BSD hosts (unless you count MacOS as BSD).

anoduck commented 10 months ago

@aloisklink I see, this is complex due to Mermaid's requirement to generate output in a browser environment. OpenBSD does provide chromedriver in it's ports tree, if this is any help. Also, pyppeteer works fine, just not puppeteer.

As mentioned previously, I personally reached out to the puppeteer development team upon receiving the dreaded, 'unsupported OS system' error message. To which I inquired if OpenBSD was at any way supported at all? The head developer immediately closed the issue out with the comment, "Isn't that what the message says? Unsupported.", without providing any explanation, insight as to why, or opportunity for further dialogue. So, I tried.

If you need someone to run tests or look into anything further let me know, but as for now, I am satisfied with explanation and support received.

Cheers.