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

Add puppeteer.launch options available into CLI #29

Conversation

leblanc-simon
Copy link
Contributor

You have added an awesome option into the API to customize puppeteer. This merge request try to allow use this option into the CLI

Example (because require escape JSON into the CLI... but I don't know how to do this without) :

./packages/convert-svg-to-png/bin/convert-svg-to-png --width 300 --puppeteer "{\"args\": [\"--no-sandbox\"],\"dumpio\":true}" *.svg

@neocotic
Copy link
Owner

neocotic commented Dec 8, 2017

@leblanc-simon First of all, thanks for your PR! This was a going to be a bit tricky, which is why I kept it separate from #25. I think you're right that a JSON string is the best option, at least initially. I had considered supporting individual options, however, type casting would quickly and easily become an issue.

If you're using Windows, you may have to escape the JSON as you have in your example, otherwise, you should be able to simply wrap the JSON using single quotes.

I'll try to take a deeper look and test this soon. Sadly, I still haven't got around to improving the testing framework to include CLI tests.

Copy link
Owner

@neocotic neocotic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@neocotic neocotic merged commit c79be10 into neocotic:develop Dec 8, 2017
@neocotic neocotic added this to the 0.3.3 milestone Dec 8, 2017
@neocotic neocotic mentioned this pull request Dec 8, 2017
1 task
@neocotic
Copy link
Owner

neocotic commented Dec 8, 2017

I've just released v0.3.3 which includes this change. Thanks again for your PR.

@leblanc-simon leblanc-simon deleted the features/puppeteer-launch-options-cli branch December 9, 2017 09:50
@leblanc-simon
Copy link
Contributor Author

Thanks !
I'm on Linux but I have some difficulties to escape JSON with simple quote. I'm lazy :) So when I found the good escape, I don't search any further

@alohaninja
Copy link

alohaninja commented Apr 23, 2018

I had to use the same JSON escape sequence on Windows for Powershell...also disabling the GPU and sandbox setting to avoid the hang with Protocol error (Page.enable): target closed error.

It helped me to start with a simple puppeteer example. This ensures puppeteer is configured and running properly in your workspace.

Running Convert SVG in Powershell

convert-svg-to-png --puppeteer --% "{\"args\": [\"--disable-gpu\", \"--no-sandbox\"]}" .\example.svg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants