mermaid-js / mermaid-cli

Command line tool for the Mermaid library
MIT License
2.35k stars 227 forks source link

Hide "Puppeteer old Headless deprecation warning" #555

Closed aloisklink closed 1 year ago

aloisklink commented 1 year ago

:bookmark_tabs: Summary

Hide the "Puppeteer old Headless deprecation warning" that is printed in Puppeteer v19.11.0 or later, when headless: "new" is not used.

Resolves https://github.com/mermaid-js/mermaid-cli/issues/544

:straight_ruler: Design Decisions

Using headless: "new" is the official way of hiding this warning, but it currently isn't very stable in Puppeteer v19.11.0 (see https://github.com/mermaid-js/mermaid-cli/issues/544#issuecomment-1575808425), and we can't upgrade to Puppeteer v20 until mermaid-cli drops Node.JS v14 support.

Instead, we can set headless: 1 as the default value. This is not officially supported (the official TypeScript types only allow boolean | "new" | undefined), but puppeteer only prints the warning if the headless option is true, but it still uses headless mode if the headless option is not "new" and truthy.

Thanks to @jt-nti for raising this potential fix in https://github.com/mermaid-js/mermaid-cli/issues/544#issuecomment-1602955907. @jt-nti, would you mind if I give you a Co-authored-by credit, by adding a Co-authored-by: James Taylor <3535067+jt-nti@users.noreply.github.com> git trailer to my commit's description?

:clipboard: Tasks

Make sure you

Todo before merging