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

use puppeteer fullPage option to support dynamic height #23

Merged
merged 5 commits into from
Oct 6, 2024

Conversation

scytacki
Copy link
Member

@scytacki scytacki commented Oct 4, 2024

PT Story: https://www.pivotaltracker.com/story/show/188381057

Support dynamic heights for the screenshot images.

This uses puppeteer's fullPage option.

Additionally it:

  • updates the version of puppeeter, chromium, and the AWS sdk.
  • removes the use of Babel. Babel was out of date and seemed mostly unnecessary. Originally it was used so we could use modern JS like async/await in the javascript. Now the lambda is running on Node version 20, which has built in async/await support so there is no need to transpile for that. The only downside is that we have to manually add the "use strict;" header to each javascript file.

This code has been deployed to the staging site. The basic features can be checked with the shutterbug client demo site.
https://concord-consortium.github.io/shutterbug.js/demo/

On each demo page you have to add ?shutterbugUrl=https://api.concord.org/shutterbug-staging so it uses the staging site. For example:

https://concord-consortium.github.io/shutterbug.js/demo/dynamic-css-example.html?shutterbugUrl=https://api.concord.org/shutterbug-staging

There isn't example on that demo site that uses the new fullPage option. However can be tested by snapshotting some pages:

Without fullPage:
curl --data '{"url":"https://concord.org/about/our-impact/","width":1000,"height":800}' https://api.concord.org/shutterbug-staging

With fullPage:
curl --data '{"url":"https://concord.org/about/our-impact/","width":1000,"height":800,"fullPage":true}' https://api.concord.org/shutterbug-staging

There doesn't seem to be any need to transpile this code. The only thing I can see is the automatic adding of "use strict". So it seems better to just manually add this line inorder to remove yet another dependency.
README.md Outdated Show resolved Hide resolved
@scytacki scytacki marked this pull request as ready for review October 4, 2024 19:21
@scytacki scytacki requested a review from bgoldowsky October 4, 2024 19:34
Copy link

@bgoldowsky bgoldowsky left a comment

Choose a reason for hiding this comment

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

From what I can tell this looks good.
I also tried the demos and they work as described 👍

@scytacki scytacki merged commit 4fc09c6 into master Oct 6, 2024
@scytacki scytacki deleted the 188381057-dynamic-height branch October 6, 2024 14:21
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.

3 participants