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

Rewrite to typescript with puppeteer-cluster + additional options and hooks. #554

Open
wants to merge 55 commits into
base: master
Choose a base branch
from

Conversation

jan-rycko
Copy link

Hi,
I was working on this wonderful lib for my company purposes and thought I would share the outcome. It's not perfect rewrite (much work to do that I don't have much time for), but some prooved to be very useful.

Changes in this PR include:

  • Typescript initial configuration with model for react-snap options
    • As for additional build step for git users, I think keeping dist in repo would be enough to use it as-is when someone forks it and build step is quite easy
  • Replaced highland queue with puppeteer-cluster for more stable run on long list of pages
    • In my case we run ~2000 pages with it. Some were not disposed properly and pipeline hanged near the end. Puppeteer cluster takes care of this problem and is also generally more stable and a little bit faster.
  • Updated puppeteer
  • Added hooks for css, html and page processing – allowing us to choose more freely final content
    • processPage runs twice – before inlining css (if enabled ofc) and before getting html content
  • Made minimalcss.minimize optional as it handles calls for css files separately and was buggy in some cases
    • I use purgecss on my side – with processCss hook.

More work should be done here sooner or later. I started to move some code around to make it more clear in some cases, but lot's to do here. Also – other packages should also be updated but I did not have much time for that now.

If you are open to some outside input (I can see lots of PRs are waiting for any approval) I can help you with remaining issues and make this lib even greater 😄

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

Successfully merging this pull request may close these issues.

None yet

1 participant